config

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2019 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EnvKeyRoot the environment variable key for runtime root dir
	EnvKeyRoot = "CADENCE_ROOT"
	// EnvKeyConfigDir the environment variable key for config dir
	EnvKeyConfigDir = "CADENCE_CONFIG_DIR"
	// EnvKeyEnvironment is the environment variable key for environment
	EnvKeyEnvironment = "CADENCE_ENVIRONMENT"
	// EnvKeyAvailabilityZone is the environment variable key for AZ
	EnvKeyAvailabilityZone = "CADENCE_AVAILABILTY_ZONE"
)

Variables

This section is empty.

Functions

func ListenIP added in v0.3.2

func ListenIP() (net.IP, error)

ListenIP returns the IP to bind to in Listen. It tries to find an IP that can be used by other machines to reach this machine.

func Load

func Load(env string, configDir string, zone string, config interface{}) error

Load loads the configuration from a set of yaml config files found in the config directory

The loader first fetches the set of files matching a pre-determined naming convention, then sorts them by hierarchy order and after that, simply loads the files one after another with the key/values in the later files overriding the key/values in the earlier files

The hierarchy is as follows from lowest to highest

base.yaml
    env.yaml   -- environment is one of the input params ex-development
      env_az.yaml -- zone is another input param

Types

type Address added in v0.5.0

type Address struct {
	// RPCName indicate the remote service name
	RPCName string `yaml:"rpcName"`
	// Address indicate the remote service IP address
	RPCAddress string `yaml:"rpcAddress"`
}

Address indicate the remote cluster's service name and address

type Archival added in v0.5.0

type Archival struct {
	// Status is the status of archival either: enabled, disabled, or paused
	Status string `yaml:"status"`
	// Filestore the configuration for file based blobstore
	Filestore filestore.Config `yaml:"filestore"`
}

Archival contains the config for archival

type BootstrapMode

type BootstrapMode int

BootstrapMode is an enum type for ringpop bootstrap mode

const (
	// BootstrapModeNone represents a bootstrap mode set to nothing or invalid
	BootstrapModeNone BootstrapMode = iota
	// BootstrapModeFile represents a file-based bootstrap mode
	BootstrapModeFile
	// BootstrapModeHosts represents a list of hosts passed in the configuration
	BootstrapModeHosts
	// BootstrapModeCustom represents a custom bootstrap mode
	BootstrapModeCustom
)

func (*BootstrapMode) UnmarshalYAML

func (m *BootstrapMode) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is called by the yaml package to convert the config YAML into a BootstrapMode.

type Cassandra

type Cassandra struct {
	// Hosts is a csv of cassandra endpoints
	Hosts string `yaml:"hosts" validate:"nonzero"`
	// Port is the cassandra port used for connection by gocql client
	Port int `yaml:"port"`
	// User is the cassandra user used for authentication by gocql client
	User string `yaml:"user"`
	// Password is the cassandra password used for authentication by gocql client
	Password string `yaml:"password"`
	// keyspace is the cassandra keyspace
	Keyspace string `yaml:"keyspace" validate:"nonzero"`
	// Consistency is the default cassandra consistency level
	Consistency string `yaml:"consistency"`
	// Datacenter is the data center filter arg for cassandra
	Datacenter string `yaml:"datacenter"`
	// MaxQPS is the max request rate to this datastore
	MaxQPS int `yaml:"maxQPS"`
	// MaxConns is the max number of connections to this datastore for a single keyspace
	MaxConns int `yaml:"maxConns"`
}

Cassandra contains configuration to connect to Cassandra cluster

type ClustersInfo added in v0.3.7

type ClustersInfo struct {
	// EnableGlobalDomain whether the global domain is enabled, this attr should be discarded when
	// cross DC is made public
	EnableGlobalDomain bool `yaml:"enableGlobalDomain"`
	// FailoverVersionIncrement is the increment of each cluster failover version
	FailoverVersionIncrement int64 `yaml:"failoverVersionIncrement"`
	// MasterClusterName is the master cluster name, only the master cluster can register / update domain
	// all clusters can do domain failover
	MasterClusterName string `yaml:"masterClusterName"`
	// CurrentClusterName is the name of the current cluster
	CurrentClusterName string `yaml:"currentClusterName"`
	// ClusterInitialFailoverVersions contains all cluster names to corresponding initial failover version
	ClusterInitialFailoverVersions map[string]int64 `yaml:"clusterInitialFailoverVersion"`
	// ClusterAddress contains all cluster names to corresponding address
	ClusterAddress map[string]Address `yaml:"clusterAddress"`
}

ClustersInfo contains the all cluster names and active cluster

type Config

type Config struct {
	// Ringpop is the ringpop related configuration
	Ringpop Ringpop `yaml:"ringpop"`
	// Persistence contains the configuration for cadence datastores
	Persistence Persistence `yaml:"persistence"`
	// Log is the logging config
	Log Logger `yaml:"log"`
	// ClustersInfo is the config containing all valid clusters and active cluster
	ClustersInfo ClustersInfo `yaml:"clustersInfo"`
	// DCRedirectionPolicy contains the frontend datacenter redirection policy
	DCRedirectionPolicy DCRedirectionPolicy `yaml:"dcRedirectionPolicy"`
	// Services is a map of service name to service config items
	Services map[string]Service `yaml:"services"`
	// Kafka is the config for connecting to kafka
	Kafka messaging.KafkaConfig `yaml:"kafka"`
	// Archival is the config for archival
	Archival Archival `yaml:"archival"`
	// ElasticSearch if config for connecting to ElasticSearch
	ElasticSearch elasticsearch.Config `yaml:elasticsearch`
}

Config contains the configuration for a set of cadence services

func (*Config) String

func (c *Config) String() string

String converts the config object into a string

func (*Config) Validate added in v0.4.0

func (c *Config) Validate() error

Validate validates this config

type DCRedirectionPolicy added in v0.5.2

type DCRedirectionPolicy struct {
	Policy string `yaml:"policy"`
	ToDC   string `yaml:"toDC"`
}

DCRedirectionPolicy contains the frontend datacenter redirection policy

type DataStore added in v0.4.0

type DataStore struct {
	// Cassandra contains the config for a cassandra datastore
	Cassandra *Cassandra `yaml:"cassandra"`
	// SQL contains the config for a SQL based datastore
	SQL *SQL `yaml:"sql"`
}

DataStore is the configuration for a single datastore

type Logger

type Logger struct {
	// Stdout is true if the output needs to goto standard out
	Stdout bool `yaml:"stdout"`
	// Level is the desired log level
	Level string `yaml:"level"`
	// OutputFile is the path to the log output file
	OutputFile string `yaml:"outputFile"`
}

Logger contains the config items for logger

func (*Logger) NewBarkLogger

func (cfg *Logger) NewBarkLogger() bark.Logger

NewBarkLogger builds and returns a new bark logger for this logging configuration

type Metrics

type Metrics struct {
	// M3 is the configuration for m3 metrics reporter
	M3 *m3.Configuration `yaml:"m3"`
	// Statsd is the configuration for statsd reporter
	Statsd *Statsd `yaml:"statsd"`
	// Tags is the set of key-value pairs to be reported
	// as part of every metric
	Tags map[string]string `yaml:"tags"`
}

Metrics contains the config items for metrics subsystem

func (*Metrics) NewScope

func (c *Metrics) NewScope() tally.Scope

NewScope builds a new tally scope for this metrics configuration

If the underlying configuration is valid for multiple reporter types, only one of them will be used for reporting. Currently, m3 is preferred over statsd

type PProf added in v0.3.5

type PProf struct {
	// Port is the port on which the PProf will bind to
	Port int `yaml:"port"`
}

PProf contains the rpc config items

func (*PProf) NewInitializer added in v0.3.5

func (cfg *PProf) NewInitializer(logger bark.Logger) *PProfInitializerImpl

NewInitializer create a new instance of PProf Initializer

type PProfInitializerImpl added in v0.3.5

type PProfInitializerImpl struct {
	PProf  *PProf
	Logger bark.Logger
}

PProfInitializerImpl initialize the pprof based on config

func (*PProfInitializerImpl) Start added in v0.3.5

func (initializer *PProfInitializerImpl) Start() error

Start the pprof based on config

type Persistence added in v0.4.0

type Persistence struct {
	// DefaultStore is the name of the default data store to use
	DefaultStore string `yaml:"defaultStore" validate:"nonzero"`
	// VisibilityStore is the name of the datastore to be used for visibility records
	VisibilityStore string `yaml:"visibilityStore" validate:"nonzero"`
	// HistoryMaxConns is the desired number of conns to history store. Value specified
	// here overrides the MaxConns config specified as part of datastore
	HistoryMaxConns int `yaml:"historyMaxConns"`
	// NumHistoryShards is the desired number of history shards. This config doesn't
	// belong here, needs refactoring
	NumHistoryShards int `yaml:"numHistoryShards" validate:"nonzero"`
	// DataStores contains the configuration for all datastores
	DataStores map[string]DataStore `yaml:"datastores"`
	// VisibilityConfig is config for visibility sampling
	VisibilityConfig *VisibilityConfig
}

Persistence contains the configuration for data store / persistence layer

func (*Persistence) SetMaxQPS added in v0.4.0

func (c *Persistence) SetMaxQPS(key string, qps int)

SetMaxQPS sets the MaxQPS value for the given datastore

func (*Persistence) Validate added in v0.4.0

func (c *Persistence) Validate() error

Validate validates the persistence config

type RPC added in v0.3.2

type RPC struct {
	// Port is the port  on which the channel will bind to
	Port int `yaml:"port"`
	// BindOnLocalHost is true if localhost is the bind address
	BindOnLocalHost bool `yaml:"bindOnLocalHost"`
	// BindOnIP can be used to bind service on specific ip (eg. `0.0.0.0`) -
	// check net.ParseIP for supported syntax, only IPv4 is supported,
	// mutually exclusive with `BindOnLocalHost` option
	BindOnIP string `yaml:"bindOnIP"`
	// DisableLogging disables all logging for rpc
	DisableLogging bool `yaml:"disableLogging"`
	// LogLevel is the desired log level
	LogLevel string `yaml:"logLevel"`
}

RPC contains the rpc config items

func (*RPC) NewFactory added in v0.3.2

func (cfg *RPC) NewFactory(sName string, logger bark.Logger) *RPCFactory

NewFactory builds a new RPCFactory conforming to the underlying configuration

type RPCFactory added in v0.3.2

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

RPCFactory is an implementation of service.RPCFactory interface

func (*RPCFactory) CreateDispatcher added in v0.3.2

func (d *RPCFactory) CreateDispatcher() *yarpc.Dispatcher

CreateDispatcher creates a dispatcher for inbound

func (*RPCFactory) CreateDispatcherForOutbound added in v0.3.2

func (d *RPCFactory) CreateDispatcherForOutbound(
	callerName, serviceName, hostName string) *yarpc.Dispatcher

CreateDispatcherForOutbound creates a dispatcher for outbound connection

type Replicator added in v0.3.7

type Replicator struct{}

Replicator describes the configuration of replicator

type Ringpop

type Ringpop struct {
	// Name to be used in ringpop advertisement
	Name string `yaml:"name" validate:"nonzero"`
	// BootstrapMode is a enum that defines the ringpop bootstrap method
	BootstrapMode BootstrapMode `yaml:"bootstrapMode"`
	// BootstrapHosts is a list of seed hosts to be used for ringpop bootstrap
	BootstrapHosts []string `yaml:"bootstrapHosts"`
	// BootstrapFile is the file path to be used for ringpop bootstrap
	BootstrapFile string `yaml:"bootstrapFile"`
	// MaxJoinDuration is the max wait time to join the ring
	MaxJoinDuration time.Duration `yaml:"maxJoinDuration"`
	// Custom discovery provider, cannot be specified through yaml
	DiscoveryProvider discovery.DiscoverProvider `yaml:"-"`
}

Ringpop contains the ringpop config items

func (*Ringpop) NewFactory

func (rpConfig *Ringpop) NewFactory() (*RingpopFactory, error)

NewFactory builds a ringpop factory conforming to the underlying configuration

type RingpopFactory

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

RingpopFactory implements the RingpopFactory interface

func (*RingpopFactory) CreateRingpop

func (factory *RingpopFactory) CreateRingpop(dispatcher *yarpc.Dispatcher) (*ringpop.Ringpop, error)

CreateRingpop is the implementation for RingpopFactory.CreateRingpop

type SQL added in v0.4.0

type SQL struct {
	// User is the username to be used for the conn
	User string `yaml:"user"`
	// Password is the password corresponding to the user name
	Password string `yaml:"password"`
	// DriverName is the name of SQL driver
	DriverName string `yaml:"driverName" validate:"nonzero"`
	// DatabaseName is the name of SQL database to connect to
	DatabaseName string `yaml:"databaseName" validate:"nonzero"`
	// ConnectAddr is the remote addr of the database
	ConnectAddr string `yaml:"connectAddr" validate:"nonzero"`
	// ConnectProtocol is the protocol that goes with the ConnectAddr ex - tcp, unix
	ConnectProtocol string `yaml:"connectProtocol" validate:"nonzero"`
	// MaxQPS the max request rate on this datastore
	MaxQPS int `yaml:"maxQPS"`
	// MaxConns the max number of connections to this datastore
	MaxConns int `yaml:"maxConns"`
	// NumShards is the number of storage shards to use for tables
	// in a sharded sql database. The default value for this param is 1
	NumShards int `yaml:"nShards"`
}

SQL is the configuration for connecting to a SQL backed datastore

type Service

type Service struct {
	// TChannel is the tchannel configuration
	RPC RPC `yaml:"rpc"`
	// Metrics is the metrics subsystem configuration
	Metrics Metrics `yaml:"metrics"`
	// PProf is the PProf configuration
	PProf PProf `yaml:"pprof"`
}

Service contains the service specific config items

type Statsd

type Statsd 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"`
}

Statsd contains the config items for statsd metrics reporter

type VisibilityConfig added in v0.5.3

type VisibilityConfig struct {
	// EnableSampling for visibility
	EnableSampling dynamicconfig.BoolPropertyFn
	// EnableReadFromClosedExecutionV2 read closed from v2 table
	EnableReadFromClosedExecutionV2 dynamicconfig.BoolPropertyFn
	// VisibilityOpenMaxQPS max QPS for record open workflows
	VisibilityOpenMaxQPS dynamicconfig.IntPropertyFnWithDomainFilter
	// VisibilityClosedMaxQPS max QPS for record closed workflows
	VisibilityClosedMaxQPS dynamicconfig.IntPropertyFnWithDomainFilter
	// VisibilityListMaxQPS max QPS for list workflow
	VisibilityListMaxQPS dynamicconfig.IntPropertyFnWithDomainFilter
}

VisibilityConfig is config for visibility sampling

Jump to

Keyboard shortcuts

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