dbconfig

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TOMLMappingFieldTag is the special tag for the field in the config struct.
	// The value of the tag is the key in the toml.
	TOMLMappingFieldTag = "tomlmapping"

	// InlinedFieldTag indicates the field should be inlined.
	InlinedFieldTag = ",inline"
)

Variables

This section is empty.

Functions

func FromCluster

func FromCluster(cluster *v1alpha1.GreptimeDBCluster, roleSpec v1alpha1.RoleSpec) ([]byte, error)

FromCluster creates config data from the cluster CRD.

func FromStandalone

func FromStandalone(standalone *v1alpha1.GreptimeDBStandalone) ([]byte, error)

FromStandalone creates config data from the standalone CRD.

func Marshal

func Marshal(config Config, strategy v1alpha1.ConfigMergeStrategy) ([]byte, error)

Marshal marshals the input config to toml.

Types

type Config

type Config interface {
	// Kind returns the component kind of the config.
	Kind() v1alpha1.RoleKind

	// ConfigureByCluster configures the config by the given cluster.
	ConfigureByCluster(cluster *v1alpha1.GreptimeDBCluster, roleSpec v1alpha1.RoleSpec) error

	// ConfigureByStandalone configures the config by the given standalone.
	ConfigureByStandalone(standalone *v1alpha1.GreptimeDBStandalone) error

	// GetInputConfig returns the input config.
	GetInputConfig() string

	// SetInputConfig sets the input config.
	SetInputConfig(input string) error
}

Config is the interface for the config of greptimedb.

func NewFromRoleKind added in v0.3.0

func NewFromRoleKind(kind v1alpha1.RoleKind) (Config, error)

NewFromRoleKind creates config from the role kind.

type DatanodeConfig

type DatanodeConfig struct {
	NodeID        *uint64 `tomlmapping:"node_id"`
	RPCBindAddr   *string `tomlmapping:"grpc.bind_addr"`
	RPCServerAddr *string `tomlmapping:"grpc.server_addr"`

	// StorageConfig is the configuration for the storage.
	StorageConfig `tomlmapping:",inline"`

	// WALConfig is the configuration for the WAL.
	WALConfig `tomlmapping:",inline"`

	// LoggingConfig is the configuration for the logging.
	LoggingConfig `tomlmapping:",inline"`

	// TracingConfig is the configuration for the tracing.
	TracingConfig `tomlmapping:",inline"`

	// InputConfig is from config field of cluster spec.
	InputConfig string
}

DatanodeConfig is the configuration for the datanode.

func (*DatanodeConfig) ConfigureByCluster

func (c *DatanodeConfig) ConfigureByCluster(cluster *v1alpha1.GreptimeDBCluster, roleSpec v1alpha1.RoleSpec) error

ConfigureByCluster configures the datanode config by the given cluster.

func (*DatanodeConfig) ConfigureByStandalone

func (c *DatanodeConfig) ConfigureByStandalone(_ *v1alpha1.GreptimeDBStandalone) error

ConfigureByStandalone is not need to implement in cluster mode.

func (*DatanodeConfig) GetInputConfig

func (c *DatanodeConfig) GetInputConfig() string

GetInputConfig returns the input config.

func (*DatanodeConfig) Kind

func (c *DatanodeConfig) Kind() v1alpha1.RoleKind

Kind returns the component kind of the datanode.

func (*DatanodeConfig) SetInputConfig

func (c *DatanodeConfig) SetInputConfig(input string) error

SetInputConfig sets the input config.

type FlownodeConfig

type FlownodeConfig struct {
	NodeID        *uint64 `tomlmapping:"node_id"`
	RPCBindAddr   *string `tomlmapping:"grpc.bind_addr"`
	RPCServerAddr *string `tomlmapping:"grpc.server_addr"`

	// LoggingConfig is the configuration for the logging.
	LoggingConfig `tomlmapping:",inline"`

	// TracingConfig is the configuration for the tracing.
	TracingConfig `tomlmapping:",inline"`

	// InputConfig is from config field of cluster spec.
	InputConfig string
}

FlownodeConfig is the configuration for the datanode.

func (*FlownodeConfig) ConfigureByCluster

func (c *FlownodeConfig) ConfigureByCluster(cluster *v1alpha1.GreptimeDBCluster, roleSpec v1alpha1.RoleSpec) error

ConfigureByCluster configures the datanode config by the given cluster.

func (*FlownodeConfig) ConfigureByStandalone

func (c *FlownodeConfig) ConfigureByStandalone(_ *v1alpha1.GreptimeDBStandalone) error

ConfigureByStandalone is not need to implement in cluster mode.

func (*FlownodeConfig) GetInputConfig

func (c *FlownodeConfig) GetInputConfig() string

GetInputConfig returns the input config.

func (*FlownodeConfig) Kind

func (c *FlownodeConfig) Kind() v1alpha1.RoleKind

Kind returns the component kind of the datanode.

func (*FlownodeConfig) SetInputConfig

func (c *FlownodeConfig) SetInputConfig(input string) error

SetInputConfig sets the input config.

type FrontendConfig

type FrontendConfig struct {
	// StoreConfig is the configuration for the store.
	StorageConfig `tomlmapping:",inline"`

	// LoggingConfig is the configuration for the logging.
	LoggingConfig `tomlmapping:",inline"`

	// SlowQueryConfig is the configuration for the slow query.
	SlowQueryConfig `tomlmapping:",inline"`

	// TracingConfig is the configuration for the tracing.
	TracingConfig `tomlmapping:",inline"`

	// InputConfig is from config field of cluster spec.
	InputConfig string
}

FrontendConfig is the configuration for the frontend.

func (*FrontendConfig) ConfigureByCluster

func (c *FrontendConfig) ConfigureByCluster(cluster *v1alpha1.GreptimeDBCluster, roleSpec v1alpha1.RoleSpec) error

ConfigureByCluster is not need to implement in frontend components.

func (*FrontendConfig) ConfigureByStandalone

func (c *FrontendConfig) ConfigureByStandalone(_ *v1alpha1.GreptimeDBStandalone) error

ConfigureByStandalone is not need to implement in cluster mode.

func (*FrontendConfig) GetInputConfig

func (c *FrontendConfig) GetInputConfig() string

GetInputConfig returns the input config of the frontend.

func (*FrontendConfig) Kind

func (c *FrontendConfig) Kind() v1alpha1.RoleKind

Kind returns the component kind of the frontend.

func (*FrontendConfig) SetInputConfig

func (c *FrontendConfig) SetInputConfig(inputConfig string) error

SetInputConfig sets the input config of the frontend.

type LoggingConfig

type LoggingConfig struct {
	// The directory to store the log files. If set to empty, logs will not be written to files.
	Dir *string `tomlmapping:"logging.dir"`

	// The log level. Can be `info`/`debug`/`warn`/`error`.
	Level *string `tomlmapping:"logging.level"`

	// The log format. Can be `text`/`json`.
	LogFormat *string `tomlmapping:"logging.log_format"`
}

LoggingConfig is the configuration for the logging.

func (*LoggingConfig) ConfigureLogging

func (c *LoggingConfig) ConfigureLogging(spec *v1alpha1.LoggingSpec)

ConfigureLogging configures the logging config with the given logging spec.

type MetaConfig

type MetaConfig struct {
	// Enable region failover.
	EnableRegionFailover *bool `tomlmapping:"enable_region_failover"`

	// If it's not empty, the meta will store all data with this key prefix.
	StoreKeyPrefix *string `tomlmapping:"store_key_prefix"`

	// The store addrs.
	StoreAddrs []string `tomlmapping:"store_addrs"`

	// The meta table name.
	MetaTableName *string `tomlmapping:"meta_table_name"`

	// The meta election lock id.
	MetaElectionLockID *uint64 `tomlmapping:"meta_election_lock_id"`

	// The backend storage type.
	Backend *string `tomlmapping:"backend"`

	// The wal provider.
	WalProvider *string `tomlmapping:"wal.provider"`

	// The kafka broker endpoints.
	WalBrokerEndpoints []string `tomlmapping:"wal.broker_endpoints"`

	// LoggingConfig is the configuration for the logging.
	LoggingConfig `tomlmapping:",inline"`

	// TracingConfig is the configuration for the tracing.
	TracingConfig `tomlmapping:",inline"`

	// InputConfig is from config field of cluster spec.
	InputConfig string
}

MetaConfig is the configuration for the meta.

func (*MetaConfig) ConfigureByCluster

func (c *MetaConfig) ConfigureByCluster(cluster *v1alpha1.GreptimeDBCluster, roleSpec v1alpha1.RoleSpec) error

ConfigureByCluster configures the meta config by the given cluster.

func (*MetaConfig) ConfigureByStandalone

func (c *MetaConfig) ConfigureByStandalone(_ *v1alpha1.GreptimeDBStandalone) error

ConfigureByStandalone is not need to implement in cluster mode.

func (*MetaConfig) GetInputConfig

func (c *MetaConfig) GetInputConfig() string

GetInputConfig returns the input config of the meta.

func (*MetaConfig) Kind

func (c *MetaConfig) Kind() v1alpha1.RoleKind

Kind returns the component kind of the meta.

func (*MetaConfig) SetInputConfig

func (c *MetaConfig) SetInputConfig(inputConfig string) error

SetInputConfig sets the input config of the meta.

type SlowQueryConfig added in v0.3.0

type SlowQueryConfig struct {
	// The slow query enabled.
	Enabled *bool `tomlmapping:"slow_query.enable"`

	// The slow query record type.
	RecordType *string `tomlmapping:"slow_query.record_type"`

	// The slow query threshold.
	Threshold *string `tomlmapping:"slow_query.threshold"`

	// The slow query sample ratio.
	SampleRatio *float64 `tomlmapping:"slow_query.sample_ratio"`

	// The TTL of the `slow_queries` system table.
	TTL *string `tomlmapping:"slow_query.ttl"`
}

SlowQueryConfig is the configuration for the slow query.

func (*SlowQueryConfig) ConfigureSlowQuery added in v0.3.0

func (c *SlowQueryConfig) ConfigureSlowQuery(spec *v1alpha1.SlowQuery)

type StandaloneConfig

type StandaloneConfig struct {
	// StorageConfig is the configuration for the storage.
	StorageConfig `tomlmapping:",inline"`

	// WALConfig is the configuration for the WAL.
	WALConfig `tomlmapping:",inline"`

	// LoggingConfig is the configuration for the logging.
	LoggingConfig `tomlmapping:",inline"`

	// SlowQueryConfig is the configuration for the slow query.
	SlowQueryConfig `tomlmapping:",inline"`

	// TracingConfig is the configuration for the tracing.
	TracingConfig `tomlmapping:",inline"`

	// InputConfig is from config field of cluster spec.
	InputConfig string
}

StandaloneConfig is the configuration for the frontend.

func (*StandaloneConfig) ConfigureByCluster

func (c *StandaloneConfig) ConfigureByCluster(_ *v1alpha1.GreptimeDBCluster, _ v1alpha1.RoleSpec) error

ConfigureByCluster is not need to implement in standalone mode.

func (*StandaloneConfig) ConfigureByStandalone

func (c *StandaloneConfig) ConfigureByStandalone(standalone *v1alpha1.GreptimeDBStandalone) error

ConfigureByStandalone is not need to implement in cluster mode.

func (*StandaloneConfig) GetInputConfig

func (c *StandaloneConfig) GetInputConfig() string

GetInputConfig returns the input config of the standalone.

func (*StandaloneConfig) Kind

Kind returns the component kind of the standalone.

func (*StandaloneConfig) SetInputConfig

func (c *StandaloneConfig) SetInputConfig(inputConfig string) error

SetInputConfig sets the input config of the standalone.

type StorageConfig

type StorageConfig struct {
	StorageType            *string `tomlmapping:"storage.type"`
	StorageDataHome        *string `tomlmapping:"storage.data_home"`
	StorageAccessKeyID     *string `tomlmapping:"storage.access_key_id"`
	StorageSecretAccessKey *string `tomlmapping:"storage.secret_access_key"`
	StorageAccessKeySecret *string `tomlmapping:"storage.access_key_secret"`
	StorageBucket          *string `tomlmapping:"storage.bucket"`
	StorageRoot            *string `tomlmapping:"storage.root"`
	StorageRegion          *string `tomlmapping:"storage.region"`
	StorageEndpoint        *string `tomlmapping:"storage.endpoint"`
	StorageScope           *string `tomlmapping:"storage.scope"`
	StorageCredential      *string `tomlmapping:"storage.credential"`
	Container              *string `tomlmapping:"storage.container"`
	AccountName            *string `tomlmapping:"storage.account_name"`
	AccountKey             *string `tomlmapping:"storage.account_key"`
	CacheCapacity          *string `tomlmapping:"storage.cache_capacity"`
	CachePath              *string `tomlmapping:"storage.cache_path"`
	EnableVirtualHostStyle *bool   `tomlmapping:"storage.enable_virtual_host_style"`
}

StorageConfig is the configuration for the storage.

func (*StorageConfig) ConfigureObjectStorage

func (c *StorageConfig) ConfigureObjectStorage(namespace string, accessor v1alpha1.ObjectStorageProviderAccessor) error

ConfigureObjectStorage configures the storage config by the given object storage provider accessor.

type TracingConfig added in v0.4.2

type TracingConfig struct {
	// Enable OTLP tracing.
	Enabled *bool `tomlmapping:"logging.enable_otlp_tracing"`

	// The OTLP tracing endpoint.
	Endpoint *string `tomlmapping:"logging.otlp_endpoint"`

	// The percentage of tracing will be sampled and exported.
	SampleRatio *float64 `tomlmapping:"logging.tracing_sample_ratio.default_ratio"`
}

TracingConfig is the configuration for the tracing.

func (*TracingConfig) ConfigureTracing added in v0.4.2

func (c *TracingConfig) ConfigureTracing(spec *v1alpha1.TracingSpec)

ConfigureTracing configures the tracing config with the given tracing spec.

type WALConfig

type WALConfig struct {
	// The wal file directory.
	WalDir *string `tomlmapping:"wal.dir"`

	// The wal provider.
	WalProvider *string `tomlmapping:"wal.provider"`

	// The kafka broker endpoints.
	WalBrokerEndpoints []string `tomlmapping:"wal.broker_endpoints"`
}

WALConfig is the configuration for the WAL.

Jump to

Keyboard shortcuts

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