config

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger() *zap.SugaredLogger

NewLogger creates a new default logger it will need to be closed with ``` defer logger.Desugar().Sync() ``` to make sure all has been piped out before terminating

Types

type AutoRefreshXConfig

type AutoRefreshXConfig struct {
	ConfigInterface
	// contains filtered or unexported fields
}

AutoRefreshXConfig is the config needed for the autorefresh object it's composed by a ConfigInterface object and therefore inherits all the methods of ConfigInterface

func (*AutoRefreshXConfig) GetMutexObj

func (c *AutoRefreshXConfig) GetMutexObj() *sync.RWMutex

GetMutexObj returns a pointer to a sync.RWMutex object

type AutoRefreshXConfigInterface

type AutoRefreshXConfigInterface interface {
	ConfigInterface
	GetMutexObj() *sync.RWMutex
}

AutoRefreshXConfigInterface is the refresh.AutoRefreshX config interface, embeds ConfigInterface

func NewAutoRefreshXConfig

func NewAutoRefreshXConfig(mutexObj *sync.RWMutex, config ConfigInterface) AutoRefreshXConfigInterface

NewAutoRefreshXConfig returns an object implementing AutoRefreshXConfigInterface

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config is the core setup of any other config object, holds information about tls, refreshing time of TLS secrets and logger used for publisher/subscriber objects (using zap SugaredLogger)

func (*Config) GetLogger

func (c *Config) GetLogger() *zap.SugaredLogger

GetLogger returns internal logger used for operations

func (*Config) GetRefreshTimeout

func (c *Config) GetRefreshTimeout() time.Duration

GetRefreshTimeout returns the duration of a refreshing cycle, used by AutoRefreshX

func (*Config) GetTLS

func (c *Config) GetTLS() *tls.Config

GetTLS returns a crypto/tls Config pointer made from the insatnce attribute c.tlsConfig

func (*Config) GetTLSConfig

func (c *Config) GetTLSConfig() *kiloTLS.TLSConfig

GetTLSConfig returns a pointer to a TLSConfig

type ConfigInterface

type ConfigInterface interface {
	GetLogger() *zap.SugaredLogger
	GetTLSConfig() *kiloTLS.TLSConfig
	GetRefreshTimeout() time.Duration
	GetTLS() *tls.Config
}

ConfigInterface is the interface for a core config

func NewConfig

func NewConfig(refreshTimeout time.Duration, tlsConfig *kiloTLS.TLSConfig, logger *zap.SugaredLogger) ConfigInterface

NewConfig returns an object implementing ConfigInterface

type ReaderConfig

type ReaderConfig struct {
	ConfigInterface
	// contains filtered or unexported fields
}

ReaderConfig is a config for the core.Reader, holds subscriber informations

func (*ReaderConfig) GetBootstrapServers

func (c *ReaderConfig) GetBootstrapServers() []string

GetBootstapServers returns the kafka url the config is pointing to

func (*ReaderConfig) GetGroupID

func (c *ReaderConfig) GetGroupID() string

GetGroupID returns a consumer group ID

func (*ReaderConfig) GetReadTimeout

func (c *ReaderConfig) GetReadTimeout() time.Duration

GetReadTimeout returns the time the ReadMessage call will be allowed to wait before timing out (via context)

func (*ReaderConfig) GetTopic

func (c *ReaderConfig) GetTopic() string

GetTopic returns the topic chosed to subscribe to

func (*ReaderConfig) Workers

func (c *ReaderConfig) Workers() int

Workers returns the number of workers for a subscriber

type ReaderConfigInterface

type ReaderConfigInterface interface {
	ConfigInterface
	GetBootstrapServers() []string
	GetTopic() string
	GetGroupID() string
	Workers() int
}

ReaderConfigInterface is the core.Reader config interface, embeds ConfigInterface

func NewReaderConfig

func NewReaderConfig(cfg ConfigInterface, bootstrapServers []string, topic, groupID string, noWorkers int, readTimeout time.Duration) ReaderConfigInterface

NewReaderConfig creates a new object implementing ReaderConfigInterface

type RefreshableInterface

type RefreshableInterface interface {
	Get(ctx context.Context) (interface{}, error)
	Config() interface{}
	Close()
	Stats() interface{}
	Renew(tlsCfg *kiloTLS.TLSConfig, args ...interface{}) RefreshableInterface
}

RefreshableInterface is implemented by core.Writer and core.Reader so that they can be refreshed by AutoRefreshX

type WriterConfig

type WriterConfig struct {
	ConfigInterface
	// contains filtered or unexported fields
}

WriterConfig is a config for the core.Writer, holds subscriber informations

func (*WriterConfig) GetAsync

func (c *WriterConfig) GetAsync() bool

GetAsync returns if the publisher is supposed to be setup as async or sync

func (*WriterConfig) GetBrokers

func (c *WriterConfig) GetBrokers() []string

GetBrokers returns the configured list of brokers

func (*WriterConfig) GetEncoder

func (c *WriterConfig) GetEncoder() enc.EncoderInterface

GetEncoder returns the configured encoder

func (*WriterConfig) GetNickname

func (c *WriterConfig) GetNickname() string

GetNickname returns the nickname for the associated topic

func (*WriterConfig) GetTopic

func (c *WriterConfig) GetTopic() string

GetTopic returns the configured topic

type WriterConfigInterface

type WriterConfigInterface interface {
	ConfigInterface
	GetBrokers() []string
	GetTopic() string
	GetNickname() string
	GetAsync() bool
	GetEncoder() encoder.EncoderInterface
}

WriterConfigInterface is the core.Writer config interface, embeds ConfigInterface

func NewWriterConfig

func NewWriterConfig(cfg ConfigInterface, brokers []string, topic, nickname string, async bool, encoder enc.EncoderInterface) WriterConfigInterface

NewWriterConfig creates a new object implementing WriterConfigInterface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳