configure

package
v0.0.0-...-f5d5260 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvProduction  = "production"
	EnvDevelopment = "development"
	EnvTest        = "test"
)

Possible environment

View Source
const (
	// InputServiceName refers to the name of the cherami in service
	InputServiceName = "cherami-inputhost"
	// OutputServiceName refers to the name of the cherami out service
	OutputServiceName = "cherami-outputhost"
	// FrontendServiceName refers to the name of the cherami frontend service
	FrontendServiceName = "cherami-frontendhost"
	// ControllerServiceName refers to the name of the cherami controller service
	ControllerServiceName = "cherami-controllerhost"
	// StoreServiceName refers to the name of the cherami store service
	StoreServiceName = "cherami-storehost"
	// ReplicatorServiceName refers to the name of the cherami replicator service
	ReplicatorServiceName = "cherami-replicator"
)

Variables

View Source
var ErrNoFilesToLoad = errors.New("attempt to load configuration with no files")

ErrNoFilesToLoad is return when you attemp to call LoadFiles with no file paths

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	LogConfig            *LogConfiguration         `yaml:"logging"`
	DefaultServiceConfig *ServiceConfig            `yaml:"DefaultServiceConfig"`
	ServiceConfig        map[string]*ServiceConfig `yaml:"ServiceConfig"`
	MetadataConfig       *MetadataConfig           `yaml:"MetadataConfig"`
	ControllerConfig     *ControllerConfig         `yaml:"ControllerConfig"`
	FrontendConfig       *FrontendConfig           `yaml:"FrontendConfig"`
	StorageConfig        *StorageConfig            `yaml:"StorageConfig"`
	ReplicatorConfig     *ReplicatorConfig         `yaml:"ReplicatorConfig"`
	KafkaConfig          *KafkaConfig              `yaml:"KafkaConfig"`

	DefaultDestinationConfig *DestinationConfig `yaml:"DefaultDestinationConfig"`
}

AppConfig stores the common app config for Cherami

func (*AppConfig) GetControllerConfig

func (r *AppConfig) GetControllerConfig() CommonControllerConfig

GetControllerConfig returns the controller config

func (*AppConfig) GetDefaultServiceConfig

func (r *AppConfig) GetDefaultServiceConfig() CommonServiceConfig

GetDefaultServiceConfig returns the default service config

func (*AppConfig) GetDestinationConfig

func (r *AppConfig) GetDestinationConfig() CommonDestinationConfig

GetDestinationConfig returns the destination config

func (*AppConfig) GetFrontendConfig

func (r *AppConfig) GetFrontendConfig() CommonFrontendConfig

GetFrontendConfig returns the frontend config

func (*AppConfig) GetKafkaConfig

func (r *AppConfig) GetKafkaConfig() CommonKafkaConfig

GetKafkaConfig returns the default service config

func (*AppConfig) GetLoggingConfig

func (r *AppConfig) GetLoggingConfig() interface{}

GetLoggingConfig returns the logging config

func (*AppConfig) GetMetadataConfig

func (r *AppConfig) GetMetadataConfig() CommonMetadataConfig

GetMetadataConfig returns the metadata config

func (*AppConfig) GetReplicatorConfig

func (r *AppConfig) GetReplicatorConfig() CommonReplicatorConfig

GetReplicatorConfig returns the replicator config

func (*AppConfig) GetServiceConfig

func (r *AppConfig) GetServiceConfig(sName string) CommonServiceConfig

GetServiceConfig returns the config specific to thegiven service

func (*AppConfig) GetStorageConfig

func (r *AppConfig) GetStorageConfig() CommonStorageConfig

GetStorageConfig returns the storage config

func (*AppConfig) SetServiceConfig

func (r *AppConfig) SetServiceConfig(sName string, sCfg CommonServiceConfig)

SetServiceConfig sets the service config corresponding to the service name

type Authentication

type Authentication struct {
	Enabled  bool   `yaml:"Enabled"`
	Username string `yaml:"Username"`
	Password string `yaml:"Password"`
}

Authentication holds the authentication info to our metadata

type ClusterConfig

type ClusterConfig struct {
	Brokers    []string `yaml:"brokers"`
	Zookeepers []string `yaml:"zookeepers"`
	Chroot     string   `yaml:"chroot"`
}

ClusterConfig holds the configuration for a single Kafka cluster

type ClustersConfig

type ClustersConfig struct {
	Clusters map[string]ClusterConfig `yaml:"clusters"`
}

ClustersConfig holds the configuration for the Kafka clusters

type CommonAppConfig

type CommonAppConfig interface {
	// GetServiceConfig is used to get the service config specific to a service
	// this is mainly boottsrap config
	GetServiceConfig(serviceName string) CommonServiceConfig
	// GetMetadataConfig is used to retrieve the config related to metadata
	GetMetadataConfig() CommonMetadataConfig
	// GetControllerConfig is used to retrieve the config related to controller
	GetControllerConfig() CommonControllerConfig
	// GetFrontendConfig is used to retrieve the config related to frontend
	GetFrontendConfig() CommonFrontendConfig
	// GetStorageConfig is used to retrieve the config related to Store
	GetStorageConfig() CommonStorageConfig
	// GetReplicatorConfig is used to retrieve the config related to replicator
	GetReplicatorConfig() CommonReplicatorConfig
	// GetLoggingConfig returns the logging config to be used
	GetLoggingConfig() interface{}
	// GetDestinationConfig returns the destination config
	GetDestinationConfig() CommonDestinationConfig
	// GetDefaultServiceConfig is used to retrieve the default bootstrap service config
	GetDefaultServiceConfig() CommonServiceConfig
	// GetKafkaConfig gets the Kafka configuration
	GetKafkaConfig() CommonKafkaConfig
	// SetServiceConfig is used to set the service config specific to the service
	SetServiceConfig(serviceName string, cfg CommonServiceConfig)
}

CommonAppConfig is the interface exposed to implement app config related to cherami. Any config object which satisfies this interface can be used for configuration By default, our config is based on yaml files which has all the necessary config to bootstrap cherami services.

func NewCommonAppConfig

func NewCommonAppConfig() CommonAppConfig

NewCommonAppConfig instantiates a new app config

type CommonConfigure

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

CommonConfigure is the config implementation with yaml parse

func (*CommonConfigure) GetDatacenter

func (r *CommonConfigure) GetDatacenter() string

GetDatacenter returns the datacenter

func (*CommonConfigure) GetEnvironment

func (r *CommonConfigure) GetEnvironment() string

GetEnvironment returns the environment

func (*CommonConfigure) GetHostname

func (r *CommonConfigure) GetHostname() string

GetHostname returns the hostname

func (*CommonConfigure) Load

func (r *CommonConfigure) Load(config interface{}) error

Load loads configuration based on environment variables

func (*CommonConfigure) LoadFile

func (r *CommonConfigure) LoadFile(config interface{}, fname string) error

LoadFile loads and validates a configuration object contained in a file

func (*CommonConfigure) LoadFiles

func (r *CommonConfigure) LoadFiles(config interface{}, fnames ...string) error

LoadFiles loads a list of files, deep-merging values.

func (*CommonConfigure) SetupServerConfig

func (r *CommonConfigure) SetupServerConfig() CommonAppConfig

SetupServerConfig sets up the server config

type CommonControllerConfig

type CommonControllerConfig interface {
	// GetTopologyFile gets the topology file to be used for placement
	GetTopologyFile() string
	// GetMinInputToStoreDistance gets the minimum input<->store distance to use
	GetMinInputToStoreDistance() uint16
	// GetMaxInputToStoreDistance gets the maximum input<->store distance to use
	GetMaxInputToStoreDistance() uint16
	// GetMinInputToStoreFallbackDistance gets the minimum fallback input<->store distance
	GetMinInputToStoreFallbackDistance() uint16
	// GetMaxInputToStoreFallbackDistance gets the maximum fallback input<->store distance
	GetMaxInputToStoreFallbackDistance() uint16
	// GetMinOutputToStoreDistance gets the minimum output<->store distance to use
	GetMinOutputToStoreDistance() uint16
	// GetMaxOutputToStoreDistance gets the maximum output<->store distance to use
	GetMaxOutputToStoreDistance() uint16
	// GetMinOutputToStoreFallbackDistance gets the minimum fallback output<->store distance
	GetMinOutputToStoreFallbackDistance() uint16
	// GetMaxOutputToStoreFallbackDistance gets the maximum fallback output<->store distance
	GetMaxOutputToStoreFallbackDistance() uint16
	// GetMinStoreToStoreDistance gets the min store<->store distance
	GetMinStoreToStoreDistance() uint16
	// GetMaxStoreToStoreDistance gets the max store<->store distance
	GetMaxStoreToStoreDistance() uint16
	// GetMinStoreToStoreFallbackDistance gets the minimum fallback store<->store distance
	GetMinStoreToStoreFallbackDistance() uint16
	// GetMaxStoreToStoreFallbackDistance gets the maximum fallback store<->store distance
	GetMaxStoreToStoreFallbackDistance() uint16
}

CommonControllerConfig holds the controller related config

type CommonDestinationConfig

type CommonDestinationConfig interface {
	// GetReplicas returns the no: of replicas to be used for destinations
	GetReplicas() int16
}

CommonDestinationConfig holds the destination related config

type CommonFrontendConfig

type CommonFrontendConfig interface {
	// GetMutatePathRegex returns the regex for path mutation
	GetMutatePathRegex() string
	// GetMutatePathPassword returns the regex for path password
	GetMutatePathPassword() string
}

CommonFrontendConfig holds the frontend related config

type CommonKafkaConfig

type CommonKafkaConfig interface {
	GetKafkaClusters() []string
	GetKafkaClusterConfig(cluster string) (ClusterConfig, bool)
}

CommonKafkaConfig holds the Kafka-related config

type CommonLogConfig

type CommonLogConfig interface {
	// Configure configures the log level based on the config
	Configure(interface{})

	// GetDefaultLogger returns the logger object
	GetDefaultLogger() bark.Logger
}

CommonLogConfig holds the logging related config

type CommonMetadataConfig

type CommonMetadataConfig interface {
	// GetCassandraHosts gets the cassandra seed hosts
	GetCassandraHosts() string
	// GetPort() gets the cassandra host port
	GetPort() int
	// GetKeyspace returns the keyspace for our cassandra cluster
	GetKeyspace() string
	// GetAuthentication returns the authentication info for our cassandra cluster
	GetAuthentication() Authentication
	// GetConsistency returns the configured consistency level
	GetConsistency() string
	// GetDcFilter returns the dc filter map for the cassandra cluster
	GetDcFilter() map[string]string
	// SetCassandraHosts sets the cassandra seed list to the given set of hosts
	SetCassandraHosts(hosts string)
	// GetClusterName gets the cassandra cluster name
	GetClusterName() string
	// GetNumConns returns the desired number of
	// conns from the client to every cassandra
	// server
	GetNumConns() int
}

CommonMetadataConfig holds the metadata specific config

type CommonReplicatorConfig

type CommonReplicatorConfig interface {
	// GetReplicatorHosts returns the replicator hosts map
	GetReplicatorHosts() map[string]string
	// GetDefaultAuthoritativeZone returns the default authoritative zone from config
	GetDefaultAuthoritativeZone() string
	// GetUseStandalone checks whether a specific deployment is using standalone deployment
	GetUseStandalone(deployment string) bool
}

CommonReplicatorConfig holds the replicator related config

type CommonServiceConfig

type CommonServiceConfig interface {
	// GetDynamicConfig returns the dynamic config object
	GetDynamicConfig() interface{}
	// GetMetricsConfig returns the metrics config object
	GetMetricsConfig() interface{}
	// GetRingHosts returns the ring hosts for bootstrap
	GetRingHosts() string
	// GetLimitsEnabled is used to find if limits are enabled or not
	GetLimitsEnabled() bool
	// GetWebsocketPort returns the websocket port configured for this service
	GetWebsocketPort() int
	// GetHyperbahnBootstrapFile returns the bootstrap file
	GetHyperbahnBootstrapFile() string
	// GetPort returns the port configured for this service
	GetPort() int
	// GetListenAddress returns the address this service should listen on
	GetListenAddress() net.IP
	// SetListenAddress sets the listen address for this service
	SetListenAddress(string)
	// GetLogger returns the configured logger for this service
	GetLogger() bark.Logger
	// SetLimitsEnabled sets the limits enabled config
	SetLimitsEnabled(limit bool)
	// SetHyperbahnBootstrapFile sets the hyperbahn bootstrap file
	SetHyperbahnBootstrapFile(fname string)
	// SetRinghosts sets the ring hosts for this service
	SetRingHosts(string)
	// SetupTChannelServer is used to start the tchannel/thrift server and returns the
	// appropriate channel and the thrift server
	SetupTChannelServer(sName string, thriftServices []thrift.TChanServer) (*tchannel.Channel, *thrift.Server)
	// SetPort sets the port to the given value
	SetPort(int)
	// SetWebsocketPort sets the web socket port to the given value
	SetWebsocketPort(int)
	// SetDynamicConfig sets the dynamic config object
	SetDynamicConfig(interface{})
	// GetDeploymentName is used to get the deployment name within a DC
	GetDeploymentName() string
	// SetDeploymentName is used to set the deployment name
	SetDeploymentName(dName string) error
}

CommonServiceConfig holds the bootstrap config for a service

type CommonStorageConfig

type CommonStorageConfig interface {
	// GetHostUUID returns the hostuuid of the store
	GetHostUUID() string
	// GetStore returns the type of the store
	GetStore() string
	// GetBaseDir returns the base dir for storing the files
	GetBaseDir() string
	// SetHostUUID sets the host uuid for this store
	SetHostUUID(string)
}

CommonStorageConfig holds the storage related config

type Configure

type Configure interface {
	// GetHostname returns the hostname
	GetHostname() string

	// GetEnvironment returns the environment
	GetEnvironment() string

	// GetDatacenter returns the datacenter
	GetDatacenter() string

	// Load loads configuration based on environment variables
	Load(config interface{}) error

	// LoadFile loads and validates a configuration object contained in a file
	LoadFile(config interface{}, fname string) error

	// LoadFiles loads a list of files, deep-merging values.
	LoadFiles(config interface{}, fnames ...string) error

	// SetupServerConfig setsup the app config for the given configurator and
	// returns the loaded config
	SetupServerConfig() CommonAppConfig
}

Configure is the interface for set cherami configuration This is the factory interface which is used to implement a specific configurator. The configurator can be either yaml based config or any other config which implements the following methods.

func NewCommonConfigure

func NewCommonConfigure() Configure

NewCommonConfigure return an configure for common open source use

type ControllerConfig

type ControllerConfig struct {
	TopologyFile                     string `yaml:"TopologyFile"`
	MinInputToStoreDistance          uint16 `yaml:"MinInputToStoreDistance"`
	MaxInputToStoreDistance          uint16 `yaml:"MaxInputToStoreDistance"`
	MinInputToStoreFallbackDistance  uint16 `yaml:"MinInputToStoreFallbackDistance"`
	MaxInputToStoreFallbackDistance  uint16 `yaml:"MaxInputToStoreFallbackDistance"`
	MinOutputToStoreDistance         uint16 `yaml:"MinOutputToStoreDistance"`
	MaxOutputToStoreDistance         uint16 `yaml:"MaxOutputToStoreDistance"`
	MinOutputToStoreFallbackDistance uint16 `yaml:"MinOutputToStoreFallbackDistance"`
	MaxOutputToStoreFallbackDistance uint16 `yaml:"MaxOutputToStoreFallbackDistance"`
	MinStoreToStoreDistance          uint16 `yaml:"MinStoreToStoreDistance"`
	MaxStoreToStoreDistance          uint16 `yaml:"MaxStoreToStoreDistance"`
	MinStoreToStoreFallbackDistance  uint16 `yaml:"MinStoreToStoreFallbackDistance"`
	MaxStoreToStoreFallbackDistance  uint16 `yaml:"MaxStoreToStoreFallbackDistance"`
}

ControllerConfig holds the config info related to our controller

func NewCommonControllerConfig

func NewCommonControllerConfig() *ControllerConfig

NewCommonControllerConfig instantiates the controller config

func (*ControllerConfig) GetMaxInputToStoreDistance

func (r *ControllerConfig) GetMaxInputToStoreDistance() uint16

GetMaxInputToStoreDistance gets the maximum input<->store distance to use

func (*ControllerConfig) GetMaxInputToStoreFallbackDistance

func (r *ControllerConfig) GetMaxInputToStoreFallbackDistance() uint16

GetMaxInputToStoreFallbackDistance gets the maximum fallback input<->store distance

func (*ControllerConfig) GetMaxOutputToStoreDistance

func (r *ControllerConfig) GetMaxOutputToStoreDistance() uint16

GetMaxOutputToStoreDistance gets the maximum output<->store distance to use

func (*ControllerConfig) GetMaxOutputToStoreFallbackDistance

func (r *ControllerConfig) GetMaxOutputToStoreFallbackDistance() uint16

GetMaxOutputToStoreFallbackDistance gets the maximum fallback output<->store distance

func (*ControllerConfig) GetMaxStoreToStoreDistance

func (r *ControllerConfig) GetMaxStoreToStoreDistance() uint16

GetMaxStoreToStoreDistance gets the max store<->store distance

func (*ControllerConfig) GetMaxStoreToStoreFallbackDistance

func (r *ControllerConfig) GetMaxStoreToStoreFallbackDistance() uint16

GetMaxStoreToStoreFallbackDistance gets the maximum fallback store<->store distance

func (*ControllerConfig) GetMinInputToStoreDistance

func (r *ControllerConfig) GetMinInputToStoreDistance() uint16

GetMinInputToStoreDistance gets the minimum input<->store distance to use

func (*ControllerConfig) GetMinInputToStoreFallbackDistance

func (r *ControllerConfig) GetMinInputToStoreFallbackDistance() uint16

GetMinInputToStoreFallbackDistance gets the minimum fallback input<->store distance

func (*ControllerConfig) GetMinOutputToStoreDistance

func (r *ControllerConfig) GetMinOutputToStoreDistance() uint16

GetMinOutputToStoreDistance gets the minimum output<->store distance to use

func (*ControllerConfig) GetMinOutputToStoreFallbackDistance

func (r *ControllerConfig) GetMinOutputToStoreFallbackDistance() uint16

GetMinOutputToStoreFallbackDistance gets the minimum fallback output<->store distance

func (*ControllerConfig) GetMinStoreToStoreDistance

func (r *ControllerConfig) GetMinStoreToStoreDistance() uint16

GetMinStoreToStoreDistance gets the min store<->store distance

func (*ControllerConfig) GetMinStoreToStoreFallbackDistance

func (r *ControllerConfig) GetMinStoreToStoreFallbackDistance() uint16

GetMinStoreToStoreFallbackDistance gets the minimum fallback store<->store distance

func (*ControllerConfig) GetTopologyFile

func (r *ControllerConfig) GetTopologyFile() string

GetTopologyFile gets the topology file to be used for placement

type DestinationConfig

type DestinationConfig struct {
	Replicas int16 `yaml:"Replicas"`
}

DestinationConfig holds metadata for a topic, shared between BIn, BStore and BOut

func NewDestinationConfig

func NewDestinationConfig() *DestinationConfig

NewDestinationConfig returns the destination config

func (*DestinationConfig) GetReplicas

func (r *DestinationConfig) GetReplicas() int16

GetReplicas returns the no: of replicas for the destination

type FrontendConfig

type FrontendConfig struct {
	AllowMutatePathRegex    string `yaml:"AllowMutatePathRegex"`
	AllowMutatePathPassword string `yaml:"AllowMutatePathPassword"`
}

FrontendConfig holds the config info for frontend

func NewCommonFrontendConfig

func NewCommonFrontendConfig() *FrontendConfig

NewCommonFrontendConfig instantiates a frontend config

func (*FrontendConfig) GetMutatePathPassword

func (r *FrontendConfig) GetMutatePathPassword() string

GetMutatePathPassword implements the method

func (*FrontendConfig) GetMutatePathRegex

func (r *FrontendConfig) GetMutatePathRegex() string

GetMutatePathRegex implements the method

type KafkaConfig

type KafkaConfig struct {
	KafkaClusterConfigFile string `yaml:"kafkaClusterConfigFile"`
	ClustersConfig         atomic.Value
}

KafkaConfig holds the configuration for the Kafka client

func NewCommonKafkaConfig

func NewCommonKafkaConfig() *KafkaConfig

NewCommonKafkaConfig instantiates a Kafka config

func (*KafkaConfig) GetKafkaClusterConfig

func (r *KafkaConfig) GetKafkaClusterConfig(cluster string) (ClusterConfig, bool)

GetKafkaClusterConfig returns all kafka cluster names

func (*KafkaConfig) GetKafkaClusters

func (r *KafkaConfig) GetKafkaClusters() []string

GetKafkaClusters returns all kafka cluster names

type LogConfiguration

type LogConfiguration struct {
	Level  string `yaml:"level"`
	Stdout bool   `yaml:"stdout"`
	// contains filtered or unexported fields
}

LogConfiguration holds the log related config

func NewCommonLogConfig

func NewCommonLogConfig() *LogConfiguration

NewCommonLogConfig instantiates the log config

func (*LogConfiguration) Configure

func (r *LogConfiguration) Configure(cfg interface{})

Configure configures the log configuration

func (*LogConfiguration) GetDefaultLogger

func (r *LogConfiguration) GetDefaultLogger() bark.Logger

GetDefaultLogger returns the default logger

type MetadataConfig

type MetadataConfig struct {
	CassandraHosts string            `yaml:"CassandraHosts"`
	Port           int               `yaml:"Port"`
	Keyspace       string            `yaml:"Keyspace"`
	Authentication Authentication    `yaml:"Authentication"`
	Consistency    string            `yaml:"Consistency"`
	ClusterName    string            `yaml:"ClusterName"`
	NumConns       int               `yaml:"NumConns"`
	DcFilter       map[string]string `yaml:"DcFilter"`
}

MetadataConfig holds the config info related to our metadata

func NewCommonMetadataConfig

func NewCommonMetadataConfig() *MetadataConfig

NewCommonMetadataConfig instantiates the metadata config for cherami

func (*MetadataConfig) GetAuthentication

func (r *MetadataConfig) GetAuthentication() Authentication

GetAuthentication returns the authentication info to be used for cherami cluster

func (*MetadataConfig) GetCassandraHosts

func (r *MetadataConfig) GetCassandraHosts() string

GetCassandraHosts returns the cassandra seed hosts for our cluster

func (*MetadataConfig) GetClusterName

func (r *MetadataConfig) GetClusterName() string

GetClusterName gets the cassandra cluster name

func (*MetadataConfig) GetConsistency

func (r *MetadataConfig) GetConsistency() string

GetConsistency returns the consistency level to be used for cherami cluster

func (*MetadataConfig) GetDcFilter

func (r *MetadataConfig) GetDcFilter() map[string]string

GetDcFilter returns the dc filter map

func (*MetadataConfig) GetKeyspace

func (r *MetadataConfig) GetKeyspace() string

GetKeyspace returns the keyspace to be used for cherami cluster

func (*MetadataConfig) GetNumConns

func (r *MetadataConfig) GetNumConns() int

GetNumConns returns the desired number of conns from the client to every cassandra server

func (*MetadataConfig) GetPort

func (r *MetadataConfig) GetPort() int

GetPort gets the cassandra host port

func (*MetadataConfig) SetCassandraHosts

func (r *MetadataConfig) SetCassandraHosts(cHosts string)

SetCassandraHosts sets the cassandra hosts for the cherami cluster

type MetricsConfig

type MetricsConfig struct {
	Statsd *StatsdConfiguration `yaml:"statsd"`
}

MetricsConfig holds the statsd config

func NewCommonMetricsConfig

func NewCommonMetricsConfig() *MetricsConfig

NewCommonMetricsConfig instantiates the metrics config

type ReplicatorConfig

type ReplicatorConfig struct {
	DefaultAuthoritativeZone string            `yaml:"DefaultAuthoritativeZone"`
	ReplicatorHosts          map[string]string `yaml:"ReplicatorHosts"`
	UseStandalone            string            `yaml:"UseStandalone"`
}

ReplicatorConfig -- contains config info passed to replicator

func NewCommonReplicatorConfig

func NewCommonReplicatorConfig() *ReplicatorConfig

NewCommonReplicatorConfig returns the replicator config

func (*ReplicatorConfig) GetDefaultAuthoritativeZone

func (r *ReplicatorConfig) GetDefaultAuthoritativeZone() string

GetDefaultAuthoritativeZone returns the default authoritative zone

func (*ReplicatorConfig) GetReplicatorHosts

func (r *ReplicatorConfig) GetReplicatorHosts() map[string]string

GetReplicatorHosts returns the map of all replicator hosts

func (*ReplicatorConfig) GetUseStandalone

func (r *ReplicatorConfig) GetUseStandalone(deployment string) bool

GetUseStandalone checks whether a specific deployment is using standalone deployment

type ServiceConfig

type ServiceConfig struct {
	Port                   int            `yaml:"Port"`
	ListenAddress          string         `yaml:"ListenAddress"`
	WebsocketPort          int            `yaml:"WebsocketPort"`
	RingHosts              string         `yaml:"RingHosts"`
	LimitsEnabled          bool           `yaml:"EnableLimits"`
	HyperbahnBootstrapFile string         `yaml:"HyperbahnBootstrapFile"`
	Metrics                *MetricsConfig `yaml:"Metrics"`
	TChannelConfig         TChannelConfig `yaml:"tchannel"`
}

ServiceConfig holds service specific config

func NewCommonServiceConfig

func NewCommonServiceConfig() *ServiceConfig

NewCommonServiceConfig instantiates the common service config

func (*ServiceConfig) GetDeploymentName

func (r *ServiceConfig) GetDeploymentName() string

GetDeploymentName gets the deployment name, if any

func (*ServiceConfig) GetDynamicConfig

func (r *ServiceConfig) GetDynamicConfig() interface{}

GetDynamicConfig returns the dynamic config for this service, if any

func (*ServiceConfig) GetHyperbahnBootstrapFile

func (r *ServiceConfig) GetHyperbahnBootstrapFile() string

GetHyperbahnBootstrapFile returns the hyperbahn bootstrap file for service

func (*ServiceConfig) GetLimitsEnabled

func (r *ServiceConfig) GetLimitsEnabled() bool

GetLimitsEnabled returns if limits are enabled

func (*ServiceConfig) GetListenAddress

func (r *ServiceConfig) GetListenAddress() net.IP

GetListenAddress returns the listen address for this service

func (*ServiceConfig) GetLogger

func (r *ServiceConfig) GetLogger() bark.Logger

GetLogger returns the configured logger

func (*ServiceConfig) GetMetricsConfig

func (r *ServiceConfig) GetMetricsConfig() interface{}

GetMetricsConfig returns the metrics config for this service

func (*ServiceConfig) GetPort

func (r *ServiceConfig) GetPort() int

GetPort returns the port for this service

func (*ServiceConfig) GetRingHosts

func (r *ServiceConfig) GetRingHosts() string

GetRingHosts returns returns the ring hosts for this service

func (*ServiceConfig) GetWebsocketPort

func (r *ServiceConfig) GetWebsocketPort() int

GetWebsocketPort returns the websocket port for this service

func (*ServiceConfig) SetDeploymentName

func (r *ServiceConfig) SetDeploymentName(dName string) error

SetDeploymentName sets the deployment name, if any

func (*ServiceConfig) SetDynamicConfig

func (r *ServiceConfig) SetDynamicConfig(cfg interface{})

SetDynamicConfig sets the dynamic config for this service, if any

func (*ServiceConfig) SetHyperbahnBootstrapFile

func (r *ServiceConfig) SetHyperbahnBootstrapFile(fName string)

SetHyperbahnBootstrapFile sets the hyperbahn bootstrap file

func (*ServiceConfig) SetLimitsEnabled

func (r *ServiceConfig) SetLimitsEnabled(limit bool)

SetLimitsEnabled sets the limits enabled parameter

func (*ServiceConfig) SetListenAddress

func (r *ServiceConfig) SetListenAddress(a string)

SetListenAddress sets the listen address for this service

func (*ServiceConfig) SetPort

func (r *ServiceConfig) SetPort(port int)

SetPort sets the port for this service

func (*ServiceConfig) SetRingHosts

func (r *ServiceConfig) SetRingHosts(ringHosts string)

SetRingHosts sets the ringhosts for this service

func (*ServiceConfig) SetWebsocketPort

func (r *ServiceConfig) SetWebsocketPort(port int)

SetWebsocketPort sets the websocket port for this service

func (*ServiceConfig) SetupTChannelServer

func (r *ServiceConfig) SetupTChannelServer(sName string, thriftServices []thrift.TChanServer) (*tchannel.Channel, *thrift.Server)

SetupTChannelServer sets up the tchannel server based on the given port TODO: hookup with hyperbahn based on the config

type StatsdConfiguration

type StatsdConfiguration struct {
	// The host and port of the statsd server
	HostPort string `yaml:"hostPort" validate:"nonzero"`

	// The prefix to use in reporting to statsd
	Prefix string `yaml:"prefix" validate:"nonzero"`

	// FlushInterval is the maximum interval for sending packets.
	// If it is not specified, it defaults to 1 second.
	FlushInterval time.Duration `yaml:"flushInterval"`

	// FlushBytes specifies the maximum udp packet size you wish to send.
	// If FlushBytes is unspecified, it defaults  to 1432 bytes, which is
	// considered safe for local traffic.
	FlushBytes int `yaml:"flushBytes"`
}

StatsdConfiguration reports metrics through statsd

type StorageConfig

type StorageConfig struct {
	HostUUID string `yaml:"HostUUID"`
	Store    string `yaml:"Store"`
	BaseDir  string `yaml:"BaseDir"`
}

StorageConfig -- contains config info passed to StoreHosts

func NewCommonStorageConfig

func NewCommonStorageConfig() *StorageConfig

NewCommonStorageConfig instantiates the StorageConfig

func (*StorageConfig) GetBaseDir

func (r *StorageConfig) GetBaseDir() string

GetBaseDir returns the base dir for the storage config

func (*StorageConfig) GetHostUUID

func (r *StorageConfig) GetHostUUID() string

GetHostUUID returns the host uuid for this store

func (*StorageConfig) GetStore

func (r *StorageConfig) GetStore() string

GetStore returns the type of store

func (*StorageConfig) SetHostUUID

func (r *StorageConfig) SetHostUUID(hostUUID string)

SetHostUUID sets the host uuid for this store

type TChannelConfig

type TChannelConfig struct {
	// DisableHyperbahn is a flag to disable advertising with Hyperbahn.
	DisableHyperbahn bool `yaml:"disableHyperbahn"`
}

TChannelConfig holds the tchannel related config

type ValidationError

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

ValidationError is the returned when a configuration fails to pass validation

func (ValidationError) ErrForField

func (e ValidationError) ErrForField(name string) error

ErrForField returns the validation error for the given field

func (ValidationError) Error

func (e ValidationError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL