Documentation ¶
Index ¶
- Variables
- func ConnectEtcd(opts EtcdOpts) (*clientv3.Client, error)
- func FindGroupByReplicaset(cconfig ClusterConfig, replicaset string) (string, bool)
- func FindInstance(cconfig ClusterConfig, name string) (string, string, bool)
- func GetStorageKey(prefix, source string) (string, error)
- func HasInstance(cluster ClusterConfig, name string) bool
- func Instances(cluster ClusterConfig) []string
- func Validate(config *Config, schema []SchemaPath) error
- type AllowedValidator
- type AnyValidator
- type ArrayValidator
- type BooleanValidator
- type CheckFunc
- type ClusterConfig
- type Collector
- type CollectorFactory
- type Config
- func (config *Config) Elems(path []string) ([]string, error)
- func (config *Config) ForEach(path []string, fun func(path []string, value any))
- func (config *Config) Get(path []string) (any, error)
- func (config *Config) Merge(low *Config)
- func (config *Config) Set(path []string, value any) error
- func (config *Config) String() string
- func (config *Config) UnmarshalYAML(unmarshal func(any) error) error
- type ConfigPublisher
- type Data
- type DataCollector
- type DataCollectorFactory
- type DataPublisher
- type DataPublisherFactory
- type EnvCollector
- type EtcdAllCollector
- type EtcdAllDataPublisher
- type EtcdGetter
- type EtcdKeyCollector
- type EtcdKeyDataPublisher
- type EtcdOpts
- type EtcdTxnGetter
- type FileCollector
- type FileDataPublisher
- type FileReadFunc
- type GroupConfig
- type InstanceConfig
- type IntegerValidator
- type IntegrityEtcdAllCollector
- type IntegrityEtcdAllDataPublisher
- type IntegrityEtcdKeyCollector
- type IntegrityTarantoolAllCollector
- type IntegrityTarantoolKeyCollector
- type MapValidator
- type NotExistError
- type NumberValidator
- type RecordValidator
- type ReplicasetConfig
- type SchemaPath
- type SequenceValidator
- type SignFunc
- type StringValidator
- type TarantoolAllCollector
- type TarantoolAllDataPublisher
- type TarantoolKeyCollector
- type TarantoolKeyDataPublisher
- type ValidateError
- type Validator
- type YamlCollector
- type YamlCollectorDecorator
- type YamlConfigPublisher
- type YamlDataMergeCollector
Constants ¶
This section is empty.
Variables ¶
var ConfigEnvPaths = [][]string{}/* 234 elements not displayed */
var TarantoolSchema = []SchemaPath{}/* 234 elements not displayed */
Functions ¶
func ConnectEtcd ¶
ConnectEtcd creates a new client object for a etcd from the specified options.
func FindGroupByReplicaset ¶
func FindGroupByReplicaset(cconfig ClusterConfig, replicaset string) (string, bool)
FindGroupByReplicaset returns a group name by the replicaset name.
func FindInstance ¶
func FindInstance(cconfig ClusterConfig, name string) (string, string, bool)
FindInstance lookups for an instance in the config. If it is found, returns a group and replicaset name.
func GetStorageKey ¶
GetStorageKey extracts the key from the source that contains the config prefix.
func HasInstance ¶
func HasInstance(cluster ClusterConfig, name string) bool
HasInstance returns true if an instance with the name exists in the config.
func Instances ¶
func Instances(cluster ClusterConfig) []string
Instances returns a list of instance names from the cluster config.
func Validate ¶
func Validate(config *Config, schema []SchemaPath) error
Validate validates a configuration with the schema.
Types ¶
type AllowedValidator ¶
type AllowedValidator struct {
// contains filtered or unexported fields
}
AllowedValidator allows a set of values.
func MakeAllowedValidator ¶
func MakeAllowedValidator(validator Validator, allowed []any) AllowedValidator
MakeAllowedValidator creates a new AllowedValidator object.
type ArrayValidator ¶
type ArrayValidator struct {
// contains filtered or unexported fields
}
ArrayValidator allows an array of values.
func MakeArrayValidator ¶
func MakeArrayValidator(itemValidator Validator) ArrayValidator
MakeArrayValidator create a new ArrayValidator object with a validator for values.
type BooleanValidator ¶
type BooleanValidator struct { }
BooleanValidator allows only boolean-compatible values.
type ClusterConfig ¶
type ClusterConfig struct { Config struct { Etcd struct { Endpoints []string `yaml:"endpoints"` Username string `yaml:"username"` Password string `yaml:"password"` Prefix string `yaml:"prefix"` Ssl struct { KeyFile string `yaml:"ssl_key"` CertFile string `yaml:"ssl_cert"` CaPath string `yaml:"ca_path"` CaFile string `yaml:"ca_file"` VerifyPeer bool `yaml:"verify_peer"` VerifyHost bool `yaml:"verify_host"` } `yaml:"ssl"` Http struct { Request struct { Timeout float64 `yaml:"timeout"` } `yaml:"request"` } `yaml:"http"` } `yaml:"etcd"` Storage struct { Prefix string `yaml:"prefix"` Timeout float64 `yaml:"timeout"` Endpoints []struct { Uri string `yaml:"uri"` Login string `yaml:"login"` Password string `yaml:"password"` Params struct { Transport string `yaml:"transport"` SslKeyFile string `yaml:"ssl_key_file"` SslCertFile string `yaml:"ssl_cert_file"` SslCaFile string `yaml:"ssl_ca_file"` SslCiphers string `yaml:"ssl_ciphers"` SslPassword string `yaml:"ssl_password"` SslPasswordFile string `yaml:"ssl_password_file"` } `yaml:"params"` } `yaml:"endpoints"` } `yaml:"storage"` } `yaml:"config"` // RawConfig is a configuration of the global scope. RawConfig *Config `yaml:"-"` // Groups are parsed configurations per a group. Groups map[string]GroupConfig }
ClusterConfig describes a cluster configuration.
func MakeClusterConfig ¶
func MakeClusterConfig(config *Config) (ClusterConfig, error)
MakeClusterConfig creates a ClusterConfig object from a configuration.
func ReplaceInstanceConfig ¶
func ReplaceInstanceConfig(cconfig ClusterConfig, instance string, iconfig *Config) (ClusterConfig, error)
ReplaceInstanceConfig replaces an instance configuration.
func SetInstanceConfig ¶
func SetInstanceConfig(cconfig ClusterConfig, group, replicaset, instance string, iconfig *Config) (ClusterConfig, error)
SetInstanceConfig sets an instance configuration.
func (*ClusterConfig) UnmarshalYAML ¶
func (config *ClusterConfig) UnmarshalYAML(unmarshal func(any) error) error
UnmarshalYAML helps to unmarshal a ClusterConfig object from YAML.
type Collector ¶
type Collector interface { // Collect collects a configuration or returns an error. Collect() (*Config, error) }
Collector interface must be implemented by a configuration source collector.
type CollectorFactory ¶
type CollectorFactory interface { // NewFile creates a new data collector to collect configuration from a file. NewFile(path string) (Collector, error) // NewEtcd creates a new data collector to collect configuration from etcd. NewEtcd(etcdcli *clientv3.Client, prefix, key string, timeout time.Duration) (Collector, error) // NewTarantool creates a new data collector to collect configuration from // tarantool config storage. NewTarantool(conn tarantool.Connector, prefix, key string, timeout time.Duration) (Collector, error) }
CollectorFactory creates new data collectors.
func NewCollectorFactory ¶
func NewCollectorFactory(factory DataCollectorFactory) CollectorFactory
NewCollectorFactory turns arbitrary DataCollectorFactory into a CollectorFactory using YAML collector decorator.
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is a container for deserialized configuration.
func Instantiate ¶
func Instantiate(cluster ClusterConfig, name string) *Config
Instantiate returns a fetched instance config from the cluster config. If the cluster config has the instance then it returns a merged config of the instance from scopes: global, group, replicaset, instance. If the cluster config has not the instance then it returns a global scope of the cluster config.
func (*Config) Merge ¶
Merge merges a configuration to the current. The outside configuration has a low priority.
type ConfigPublisher ¶
type ConfigPublisher interface { // Publish publisher the configuration or returns an error. Publish(config *Config) error }
ConfigPublisher interface must be implemented by a config publisher.
type Data ¶
type Data struct { // Source is the origin of data, i.e. key in case of etcd or tarantool-based collectors. Source string // Value is data collected. Value []byte // Revision is data revision. Revision int64 }
Data represents collected data with its source.
type DataCollector ¶
DataCollector interface must be implemented by a source collector.
type DataCollectorFactory ¶
type DataCollectorFactory interface { // NewFile creates a new data collector to collect configuration from a file. NewFile(path string) (DataCollector, error) // NewEtcd creates a new data collector to collect configuration from etcd. NewEtcd(etcdcli *clientv3.Client, prefix, key string, timeout time.Duration) (DataCollector, error) // NewTarantool creates a new data collector to collect configuration from // tarantool config storage. NewTarantool(conn tarantool.Connector, prefix, key string, timeout time.Duration) (DataCollector, error) }
DataCollectorFactory creates new data collectors.
func NewDataCollectorFactory ¶
func NewDataCollectorFactory() DataCollectorFactory
NewDataCollectorFactory creates a new DataCollectorFactory.
func NewIntegrityDataCollectorFactory ¶
func NewIntegrityDataCollectorFactory(checkFunc CheckFunc, fileReadFunc FileReadFunc) DataCollectorFactory
NewIntegrityDataCollectorFactory creates a new DataCollectorFactory with integrity checks.
type DataPublisher ¶
type DataPublisher interface { // Publish publishes the interface or returns an error. Publish(revision int64, data []byte) error }
DataPublisher interface must be implemented by a raw data publisher.
type DataPublisherFactory ¶
type DataPublisherFactory interface { // NewFile creates a new data publisher to publish data into a file. NewFile(path string) (DataPublisher, error) // NewEtcd creates a new data publisher to publish data into etcd. NewEtcd(etcdcli *clientv3.Client, prefix, key string, timeout time.Duration) (DataPublisher, error) // NewTarantool creates a new data publisher to publish data into tarantool // config storage. NewTarantool(conn tarantool.Connector, prefix, key string, timeout time.Duration) (DataPublisher, error) }
DataPublisherFactory creates new data publishers.
func NewDataPublisherFactory ¶
func NewDataPublisherFactory() DataPublisherFactory
NewDataPublisherFactory creates a new DataPublisherFactory.
func NewIntegrityDataPublisherFactory ¶
func NewIntegrityDataPublisherFactory(signFunc SignFunc) DataPublisherFactory
NewIntegrityDataPublisherFactory creates a new DataPublisherFactory with integrity signing.
type EnvCollector ¶
type EnvCollector struct {
// contains filtered or unexported fields
}
EnvCollector collects a configuration from environment variables.
func NewEnvCollector ¶
func NewEnvCollector(formatter func(path []string) string) EnvCollector
NewEnvCollector creates a new EnvCollector. A path to an environment variable format function must be specified.
func (EnvCollector) Collect ¶
func (collector EnvCollector) Collect() (*Config, error)
Collect collects a configuration from environment variables.
type EtcdAllCollector ¶
type EtcdAllCollector struct {
// contains filtered or unexported fields
}
EtcdAllCollector collects data from a etcd connection for a whole prefix.
func NewEtcdAllCollector ¶
func NewEtcdAllCollector(getter EtcdGetter, prefix string, timeout time.Duration) EtcdAllCollector
NewEtcdAllCollector creates a new collector for etcd from the whole prefix.
func (EtcdAllCollector) Collect ¶
func (collector EtcdAllCollector) Collect() ([]Data, error)
Collect collects a configuration from the specified prefix with the specified timeout.
type EtcdAllDataPublisher ¶
type EtcdAllDataPublisher struct {
// contains filtered or unexported fields
}
EtcdAllDataPublisher publishes a data into etcd to a prefix.
func NewEtcdAllDataPublisher ¶
func NewEtcdAllDataPublisher(getter EtcdTxnGetter, prefix string, timeout time.Duration) EtcdAllDataPublisher
NewEtcdAllDataPublisher creates a new EtcdAllDataPublisher object to publish a data to etcd with the prefix during the timeout.
type EtcdGetter ¶
type EtcdGetter interface { // Get retrieves key-value pairs for a key. Get(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error) }
EtcdGetter is the interface that wraps get from etcd method.
type EtcdKeyCollector ¶
type EtcdKeyCollector struct {
// contains filtered or unexported fields
}
EtcdKeyCollector collects data from a etcd connection for a whole prefix.
func NewEtcdKeyCollector ¶
func NewEtcdKeyCollector(getter EtcdGetter, prefix, key string, timeout time.Duration) EtcdKeyCollector
NewEtcdKeyCollector creates a new collector for etcd from a key from a prefix.
func (EtcdKeyCollector) Collect ¶
func (collector EtcdKeyCollector) Collect() ([]Data, error)
Collect collects a configuration from the specified path with the specified timeout.
type EtcdKeyDataPublisher ¶
type EtcdKeyDataPublisher struct {
// contains filtered or unexported fields
}
EtcdKeyDataPublisher publishes a data into etcd for a prefix and a key.
func NewEtcdKeyDataPublisher ¶
func NewEtcdKeyDataPublisher(getter EtcdTxnGetter, prefix, key string, timeout time.Duration) EtcdKeyDataPublisher
NewEtcdKeyDataPublisher creates a new EtcdKeyDataPublisher object to publish a data to etcd with the prefix and key during the timeout.
func NewIntegrityEtcdKeyDataPublisher ¶
func NewIntegrityEtcdKeyDataPublisher(signFunc SignFunc, getter EtcdTxnGetter, prefix, key string, timeout time.Duration) EtcdKeyDataPublisher
NewIntegrityEtcdKeyDataPublisher creates a new EtcdKeyDataPublisher object to publish a signed data to etcd with the prefix and key during the timeout.
type EtcdOpts ¶
type EtcdOpts struct { // Endpoints a slice of endpoints to connect. Endpoints []string // Username is a user name for authorization Username string // Password is a password for authorization Password string // KeyFile is a path to a private SSL key file. KeyFile string // CertFile is a path to an SSL certificate file. CertFile string // CaPath is a path to a trusted certificate authorities (CA) directory. CaPath string // CaFile is a path to a trusted certificate authorities (CA) file. CaFile string // SkipHostVerify controls whether a client verifies the server's // certificate chain and host name. This is dangerous option so by // default it is false. SkipHostVerify bool // Timeout is a timeout for actions. Timeout time.Duration }
EtcdOpts is a way to configure a etcd client.
type EtcdTxnGetter ¶
type EtcdTxnGetter interface { EtcdGetter // Txn creates a transaction. Txn(ctx context.Context) clientv3.Txn }
EtcdTxnGetter is the interface that adds Txn method to EtcdGetter.
type FileCollector ¶
type FileCollector struct {
// contains filtered or unexported fields
}
FileCollector collects data from a YAML file.
func NewFileCollector ¶
func NewFileCollector(path string) FileCollector
NewFileCollector creates a new file collector for a path.
func NewIntegrityFileCollector ¶
func NewIntegrityFileCollector(fileReadFunc FileReadFunc, path string) FileCollector
NewIntegrityFileCollector creates a new file collector for a path with additional integrity checks.
func (FileCollector) Collect ¶
func (collector FileCollector) Collect() ([]Data, error)
Collect collects a configuration from a file located at a specified path.
type FileDataPublisher ¶
type FileDataPublisher struct {
// contains filtered or unexported fields
}
FileDataPublisher publishes a data into a file as is.
func NewFileDataPublisher ¶
func NewFileDataPublisher(path string) FileDataPublisher
NewFileDataPublisher creates a new FileDataPublisher object to publish a data into a file for the given path.
type FileReadFunc ¶
type FileReadFunc func(path string) (io.ReadCloser, error)
FileReadFunc reads a file.
type GroupConfig ¶
type GroupConfig struct { // RawConfig is a raw configuration of the group scope. RawConfig *Config `yaml:"-"` // Replicasets are parsed configurations per a replicaset. Replicasets map[string]ReplicasetConfig }
GroupConfig describes a group configuration.
func (*GroupConfig) UnmarshalYAML ¶
func (config *GroupConfig) UnmarshalYAML(unmarshal func(any) error) error
UnmarshalYAML helps to unmarshal a GroupConfig object from YAML.
type InstanceConfig ¶
type InstanceConfig struct { // RawConfig is a raw configuration of the instance scope. RawConfig *Config `yaml:"-"` }
InstanceConfig describes an instance configuration.
func MakeInstanceConfig ¶
func MakeInstanceConfig(config *Config) (InstanceConfig, error)
MakeInstanceConfig creates an InstanceConfig object from a configuration.
func (*InstanceConfig) UnmarshalYAML ¶
func (config *InstanceConfig) UnmarshalYAML(unmarshal func(any) error) error
UnmarshalYAML helps to unmarshal an InstanceConfig object from YAML.
type IntegerValidator ¶
type IntegerValidator struct { }
IntegerValidator allows only integer-compatible values.
type IntegrityEtcdAllCollector ¶
type IntegrityEtcdAllCollector struct {
// contains filtered or unexported fields
}
EtcdAllCollector collects data from a etcd connection for a whole prefix with integrity checks.
func NewIntegrityEtcdAllCollector ¶
func NewIntegrityEtcdAllCollector(checkFunc CheckFunc, getter EtcdTxnGetter, prefix string, timeout time.Duration) IntegrityEtcdAllCollector
NewIntegrityEtcdAllCollector creates a new collector for etcd from the whole prefix with integrity checks.
func (IntegrityEtcdAllCollector) Collect ¶
func (collector IntegrityEtcdAllCollector) Collect() ([]Data, error)
Collect collects a configuration from the specified prefix with the specified timeout.
type IntegrityEtcdAllDataPublisher ¶
type IntegrityEtcdAllDataPublisher struct {
// contains filtered or unexported fields
}
EtcdAllDataPublisher publishes a signed data into etcd to a prefix.
func NewIntegrityEtcdAllDataPublisher ¶
func NewIntegrityEtcdAllDataPublisher(signFunc SignFunc, getter EtcdTxnGetter, prefix string, timeout time.Duration) IntegrityEtcdAllDataPublisher
NewIntegrityEtcdAllDataPublisher creates a new IntegrityEtcdAllDataPublisher object to publish a signed data to etcd with the prefix during the timeout.
type IntegrityEtcdKeyCollector ¶
type IntegrityEtcdKeyCollector struct {
// contains filtered or unexported fields
}
func NewIntegrityEtcdKeyCollector ¶
func NewIntegrityEtcdKeyCollector(checkFunc CheckFunc, getter EtcdTxnGetter, prefix, key string, timeout time.Duration) IntegrityEtcdKeyCollector
NewIntegrityEtcdKeyCollector creates a new collector for etcd with additional integrity checks from a key from a prefix.
func (IntegrityEtcdKeyCollector) Collect ¶
func (collector IntegrityEtcdKeyCollector) Collect() ([]Data, error)
Collect collects a configuration from the specified prefix with the specified timeout.
type IntegrityTarantoolAllCollector ¶
type IntegrityTarantoolAllCollector struct {
// contains filtered or unexported fields
}
IntegrityTarantoolAllCollector collects data from a Tarantool for a prefix with integrity checks.
func NewIntegrityTarantoolAllCollector ¶
func NewIntegrityTarantoolAllCollector(checkFunc CheckFunc, conn tarantool.Connector, prefix string, timeout time.Duration) IntegrityTarantoolAllCollector
NewIntegrityTarantoolAllCollector creates a new collector for Tarantool from the whole prefix.
func (IntegrityTarantoolAllCollector) Collect ¶
func (collector IntegrityTarantoolAllCollector) Collect() ([]Data, error)
Collect collects a configuration from the specified prefix with the specified timeout.
type IntegrityTarantoolKeyCollector ¶
type IntegrityTarantoolKeyCollector struct {
// contains filtered or unexported fields
}
IntegrityTarantoolKeyCollector collects data from a Tarantool for a separate key and makes integrity checks.
func NewIntegrityTarantoolKeyCollector ¶
func NewIntegrityTarantoolKeyCollector(checkFunc CheckFunc, conn tarantool.Connector, prefix, key string, timeout time.Duration) IntegrityTarantoolKeyCollector
NewIntegrityTarantoolKeyCollector creates a new collector for Tarantool from a key from a prefix with integrity checks.
func (IntegrityTarantoolKeyCollector) Collect ¶
func (collector IntegrityTarantoolKeyCollector) Collect() ([]Data, error)
Collect collects a configuration from the specified key with the specified timeout.
type MapValidator ¶
type MapValidator struct {
// contains filtered or unexported fields
}
MapValidator allows only a map.
func MakeMapValidator ¶
func MakeMapValidator(key Validator, value Validator) MapValidator
MakeMapValidator create a new MapValidator object with specified a key and a value validator.
type NotExistError ¶
type NotExistError struct {
// contains filtered or unexported fields
}
NotExistError error type for non-existing path.
func (NotExistError) Error ¶
func (e NotExistError) Error() string
Error - error interface implementation for NotExistError.
type NumberValidator ¶
type NumberValidator struct { }
NumberValidator allows only number-compatible values.
type RecordValidator ¶
type RecordValidator struct {
// contains filtered or unexported fields
}
RecordValidator allows only a record values.
func MakeRecordValidator ¶
func MakeRecordValidator(items map[string]Validator) RecordValidator
MakeRecordValidator create a new RecordValidator object with a specified record schema.
type ReplicasetConfig ¶
type ReplicasetConfig struct { // RawConfig is a raw configuration of the replicaset scope. RawConfig *Config `yaml:"-"` // Instances are configurations at an instance scope. Instances map[string]InstanceConfig }
ReplicasetConfig describes a replicaset configuration.
func (*ReplicasetConfig) UnmarshalYAML ¶
func (config *ReplicasetConfig) UnmarshalYAML(unmarshal func(any) error) error
UnmarshalYAML helps to unmarshal a ReplicasetConfig object from YAML.
type SchemaPath ¶
type SchemaPath struct { // Path of a configuration value. Path []string // Validator to validate the configuration value. Validator Validator }
SchemaPath describes a validation schema for a configuration.
type SequenceValidator ¶
type SequenceValidator struct {
// contains filtered or unexported fields
}
SequenceValidator allows to combine validators in a sequence.
func MakeSequenceValidator ¶
func MakeSequenceValidator(validators ...Validator) SequenceValidator
MakeSequenceValidator creates a new SequenceValidator object.
type StringValidator ¶
type StringValidator struct { }
StringValidator allows only string-compatible values.
type TarantoolAllCollector ¶
type TarantoolAllCollector struct {
// contains filtered or unexported fields
}
TarantoolAllCollector collects data from a Tarantool for a whole prefix.
func NewTarantoolAllCollector ¶
func NewTarantoolAllCollector(conn tarantool.Connector, prefix string, timeout time.Duration) TarantoolAllCollector
NewTarantoolAllCollector creates a new collector for Tarantool from the whole prefix.
func (TarantoolAllCollector) Collect ¶
func (collector TarantoolAllCollector) Collect() ([]Data, error)
Collect collects a configuration from the specified prefix with the specified timeout.
type TarantoolAllDataPublisher ¶
type TarantoolAllDataPublisher struct {
// contains filtered or unexported fields
}
TarantoolAllDataPublisher publishes a data into Tarantool to a prefix.
func NewIntegrityTarantoolAllDataPublisher ¶
func NewIntegrityTarantoolAllDataPublisher(signFunc SignFunc, conn tarantool.Connector, prefix string, timeout time.Duration) TarantoolAllDataPublisher
NewIntegrityTarantoolAllDataPublisher creates a new TarantoolAllDataPublisher object to publish a signed data to Tarantool with the prefix during the timeout.
func NewTarantoolAllDataPublisher ¶
func NewTarantoolAllDataPublisher(conn tarantool.Connector, prefix string, timeout time.Duration) TarantoolAllDataPublisher
NewTarantoolAllDataPublisher creates a new TarantoolAllDataPublisher object to publish a data to Tarantool with the prefix during the timeout.
type TarantoolKeyCollector ¶
type TarantoolKeyCollector struct {
// contains filtered or unexported fields
}
TarantoolKeyCollector collects data from a Tarantool for a separate key.
func NewTarantoolKeyCollector ¶
func NewTarantoolKeyCollector(conn tarantool.Connector, prefix, key string, timeout time.Duration) TarantoolKeyCollector
NewTarantoolKeyCollector creates a new collector for Tarantool from a key from a prefix.
func (TarantoolKeyCollector) Collect ¶
func (collector TarantoolKeyCollector) Collect() ([]Data, error)
Collect collects a configuration from the specified path with the specified timeout.
type TarantoolKeyDataPublisher ¶
type TarantoolKeyDataPublisher struct {
// contains filtered or unexported fields
}
TarantoolKeyDataPublisher publishes a data into Tarantool for a prefix and a key.
func NewIntegrityTarantoolKeyDataPublisher ¶
func NewIntegrityTarantoolKeyDataPublisher(signFunc SignFunc, conn tarantool.Connector, prefix, key string, timeout time.Duration) TarantoolKeyDataPublisher
NewTarantoolKeyDataPublisher creates a new TarantoolKeyDataPublisher object to publish a signed data to Tarantool with the prefix and key during the timeout.
func NewTarantoolKeyDataPublisher ¶
func NewTarantoolKeyDataPublisher(conn tarantool.Connector, prefix, key string, timeout time.Duration) TarantoolKeyDataPublisher
NewTarantoolKeyDataPublisher creates a new TarantoolKeyDataPublisher object to publish a data to Tarantool with the prefix and key during the timeout.
func (TarantoolKeyDataPublisher) Publish ¶
func (publisher TarantoolKeyDataPublisher) Publish(revision int64, data []byte) error
Publish publishes the configuration into Tarantool to the given prefix and key. If passed revision is not 0, the data will be published only if target key revision the same.
type ValidateError ¶
type ValidateError struct {
// contains filtered or unexported fields
}
ValidateError describes a schema validation error.
func (ValidateError) Error ¶
func (err ValidateError) Error() string
Error returns a string representation of the validation error.
func (ValidateError) Path ¶
func (err ValidateError) Path() []string
Path returns a schema path to a configuration value.
func (ValidateError) Unwrap ¶
func (err ValidateError) Unwrap() []error
Error returns a list of errors for the corresponding path.
type Validator ¶
type Validator interface { // Validate validates the value and returns a validated one. Validate(value any) (any, error) }
Validator validates a value.
type YamlCollector ¶
type YamlCollector struct {
// contains filtered or unexported fields
}
YamlCollector collects a configuration from YAML data.
func NewYamlCollector ¶
func NewYamlCollector(data []byte) YamlCollector
NewYamlCollector create a new YAML collector.
func (YamlCollector) Collect ¶
func (collector YamlCollector) Collect() (*Config, error)
Collect collects configuration from YAML data.
type YamlCollectorDecorator ¶
type YamlCollectorDecorator struct {
// contains filtered or unexported fields
}
YamlCollectorDecorator is a wrapper over DataCollector implementing Collector.
func NewYamlCollectorDecorator ¶
func NewYamlCollectorDecorator(collector DataCollector) YamlCollectorDecorator
NewYamlCollectorDecorator wraps a DataCollector to interpret raw data as YAML configurations.
func (YamlCollectorDecorator) Collect ¶
func (collector YamlCollectorDecorator) Collect() (*Config, error)
Collect collects configuration from raw data interpretening it as YAML.
type YamlConfigPublisher ¶
type YamlConfigPublisher struct {
// contains filtered or unexported fields
}
YamlConfigPublisher publishes a configuration as YAML via the base publisher.
func NewYamlConfigPublisher ¶
func NewYamlConfigPublisher(publisher DataPublisher) YamlConfigPublisher
NewYamlConfigPublisher creates a new YamlConfigPublisher object to publish a configuration via the publisher.
func (YamlConfigPublisher) Publish ¶
func (publisher YamlConfigPublisher) Publish(config *Config) error
Publish publishes the configuration as YAML data.
type YamlDataMergeCollector ¶
type YamlDataMergeCollector struct {
// contains filtered or unexported fields
}
YamlDataMergeCollector collects and merges configuration from the slice of Data.
func NewYamlDataMergeCollector ¶
func NewYamlDataMergeCollector(data ...Data) YamlDataMergeCollector
NewYamlDataMergeCollector creates YamlDataMergeCollector.
func (YamlDataMergeCollector) Collect ¶
func (collector YamlDataMergeCollector) Collect() (*Config, error)
Collect collects configuration from YAML data.