paramtable

package
v0.0.0-...-1593278 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 23 Imported by: 29

Documentation

Overview

Copyright (C) 2019-2020 Zilliz. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	DefaultEasyloggingYaml      = "easylogging.yaml"
	DefaultMinioHost            = "localhost"
	DefaultMinioPort            = "9000"
	DefaultMinioAccessKey       = "minioadmin"
	DefaultMinioSecretAccessKey = "minioadmin"
	DefaultMinioUseSSL          = "false"
	DefaultMinioBucketName      = "a-bucket"
	DefaultMinioUseIAM          = "false"
	DefaultMinioCloudProvider   = "aws"
	DefaultMinioIAMEndpoint     = ""
	DefaultEtcdEndpoints        = "localhost:2379"

	DefaultLogFormat       = "text"
	DefaultLogLevelForBase = "debug"
	DefaultRootPath        = ""
)
View Source
const (
	// DefaultRetentionDuration defines the default duration for retention which is 1 days in seconds.
	DefaultRetentionDuration = 0

	// DefaultIndexSliceSize defines the default slice size of index file when serializing.
	DefaultIndexSliceSize        = 16
	DefaultGracefulTime          = 5000 // ms
	DefaultGracefulStopTimeout   = 30   // s
	DefaultThreadCoreCoefficient = 10

	DefaultSessionTTL        = 20 // s
	DefaultSessionRetryTimes = 30

	DefaultMaxDegree                = 56
	DefaultSearchListSize           = 100
	DefaultPQCodeBudgetGBRatio      = 0.125
	DefaultBuildNumThreadsRatio     = 1.0
	DefaultSearchCacheBudgetGBRatio = 0.10
	DefaultLoadNumThreadRatio       = 8.0
	DefaultBeamWidthRatio           = 4.0
)
View Source
const (
	// DefaultServerMaxSendSize defines the maximum size of data per grpc request can send by server side.
	DefaultServerMaxSendSize = 512 * 1024 * 1024

	// DefaultServerMaxRecvSize defines the maximum size of data per grpc request can receive by server side.
	DefaultServerMaxRecvSize = 512 * 1024 * 1024

	// DefaultClientMaxSendSize defines the maximum size of data per grpc request can send by client side.
	DefaultClientMaxSendSize = 256 * 1024 * 1024

	// DefaultClientMaxRecvSize defines the maximum size of data per grpc request can receive by client side.
	DefaultClientMaxRecvSize = 256 * 1024 * 1024

	// DefaultLogLevel defines the log level of grpc
	DefaultLogLevel = "WARNING"

	// Grpc Timeout related configs
	DefaultDialTimeout      = 200
	DefaultKeepAliveTime    = 10000
	DefaultKeepAliveTimeout = 20000

	// Grpc retry policy
	DefaultMaxAttempts               = 5
	DefaultInitialBackoff    float64 = 1.0
	DefaultMaxBackoff        float64 = 60.0
	DefaultBackoffMultiplier float64 = 2.0

	DefaultCompressionEnabled bool = false

	ProxyInternalPort = 19529
	ProxyExternalPort = 19530
)
View Source
const (
	// SuggestPulsarMaxMessageSize defines the maximum size of Pulsar message.
	SuggestPulsarMaxMessageSize = 5 * 1024 * 1024

	KafkaProducerConfigPrefix = "kafka.producer."
	KafkaConsumerConfigPrefix = "kafka.consumer."
)
View Source
const (

	// MBSize used to convert megabytes and bytes.
	MBSize = 1024.0 * 1024.0
)

Variables

This section is empty.

Functions

func GetCreateTime

func GetCreateTime() time.Time

func GetRole

func GetRole() string

func GetUpdateTime

func GetUpdateTime() time.Time

func Init

func Init()

func SetCreateTime

func SetCreateTime(d time.Time)

func SetNodeID

func SetNodeID(newID UniqueID)

func SetRole

func SetRole(role string)

func SetUpdateTime

func SetUpdateTime(d time.Time)

Types

type AccessLogConfig

type AccessLogConfig struct {
	Enable        ParamItem `refreshable:"false"`
	MinioEnable   ParamItem `refreshable:"false"`
	LocalPath     ParamItem `refreshable:"false"`
	Filename      ParamItem `refreshable:"false"`
	MaxSize       ParamItem `refreshable:"false"`
	RotatedTime   ParamItem `refreshable:"false"`
	MaxBackups    ParamItem `refreshable:"false"`
	RemotePath    ParamItem `refreshable:"false"`
	RemoteMaxTime ParamItem `refreshable:"false"`
}

///////////////////////////////////////////////////////////////////////////// --- proxy ---

type BaseTable

type BaseTable struct {
	YamlFiles []string
	// contains filtered or unexported fields
}

BaseTable the basics of paramtable

func NewBaseTableFromYamlOnly

func NewBaseTableFromYamlOnly(yaml string) *BaseTable

NewBaseTableFromYamlOnly only used in migration tool. Maybe we shouldn't limit the configDir internally.

func (*BaseTable) FileConfigs

func (gp *BaseTable) FileConfigs() map[string]string

func (*BaseTable) Get

func (gp *BaseTable) Get(key string) string

func (*BaseTable) GetConfigDir

func (gp *BaseTable) GetConfigDir() string

GetConfigDir returns the config directory

func (*BaseTable) GetWithDefault

func (gp *BaseTable) GetWithDefault(key, defaultValue string) string

GetWithDefault loads an object with @key. If the object does not exist, @defaultValue will be returned.

func (*BaseTable) GlobalInitWithYaml

func (gp *BaseTable) GlobalInitWithYaml(yaml string)

GlobalInitWithYaml initializes the param table with the given yaml. We will update the global DefaultYaml variable directly, once and for all. GlobalInitWithYaml shall be called at the very beginning before initiating the base table. GlobalInitWithYaml should be called only in standalone and embedded Milvus.

func (*BaseTable) Load

func (gp *BaseTable) Load(key string) (string, error)

Load loads an object with @key.

func (*BaseTable) Remove

func (gp *BaseTable) Remove(key string) error

Remove Config by key

func (*BaseTable) Reset

func (gp *BaseTable) Reset(key string) error

Reset Config to default value

func (*BaseTable) Save

func (gp *BaseTable) Save(key, value string) error

Update Config

func (*BaseTable) UpdateSourceOptions

func (gp *BaseTable) UpdateSourceOptions(opts ...config.Option)

type ComponentParam

type ComponentParam struct {
	ServiceParam

	CommonCfg       commonConfig
	QuotaConfig     quotaConfig
	AutoIndexConfig autoIndexConfig
	TraceCfg        traceConfig

	RootCoordCfg  rootCoordConfig
	ProxyCfg      proxyConfig
	QueryCoordCfg queryCoordConfig
	QueryNodeCfg  queryNodeConfig
	DataCoordCfg  dataCoordConfig
	DataNodeCfg   dataNodeConfig
	IndexNodeCfg  indexNodeConfig
	HTTPCfg       httpConfig
	LogCfg        logConfig
	HookCfg       hookConfig

	RootCoordGrpcServerCfg  GrpcServerConfig
	ProxyGrpcServerCfg      GrpcServerConfig
	QueryCoordGrpcServerCfg GrpcServerConfig
	QueryNodeGrpcServerCfg  GrpcServerConfig
	DataCoordGrpcServerCfg  GrpcServerConfig
	DataNodeGrpcServerCfg   GrpcServerConfig
	IndexNodeGrpcServerCfg  GrpcServerConfig

	RootCoordGrpcClientCfg  GrpcClientConfig
	ProxyGrpcClientCfg      GrpcClientConfig
	QueryCoordGrpcClientCfg GrpcClientConfig
	QueryNodeGrpcClientCfg  GrpcClientConfig
	DataCoordGrpcClientCfg  GrpcClientConfig
	DataNodeGrpcClientCfg   GrpcClientConfig
	IndexNodeGrpcClientCfg  GrpcClientConfig

	IntegrationTestCfg integrationTestConfig
	// contains filtered or unexported fields
}

ComponentParam is used to quickly and easily access all components' configurations.

func Get

func Get() *ComponentParam

func (*ComponentParam) GetAll

func (p *ComponentParam) GetAll() map[string]string

func (*ComponentParam) GetComponentConfigurations

func (p *ComponentParam) GetComponentConfigurations(componentName string, sub string) map[string]string

func (*ComponentParam) Init

func (p *ComponentParam) Init()

Init initialize once

func (*ComponentParam) Watch

func (p *ComponentParam) Watch(key string, watcher config.EventHandler)

type CompositeParamItem

type CompositeParamItem struct {
	Items  []*ParamItem
	Format func(map[string]string) string
}

func (*CompositeParamItem) GetValue

func (cpi *CompositeParamItem) GetValue() string

type EtcdConfig

type EtcdConfig struct {
	// --- ETCD ---
	Endpoints         ParamItem          `refreshable:"false"`
	RootPath          ParamItem          `refreshable:"false"`
	MetaSubPath       ParamItem          `refreshable:"false"`
	KvSubPath         ParamItem          `refreshable:"false"`
	MetaRootPath      CompositeParamItem `refreshable:"false"`
	KvRootPath        CompositeParamItem `refreshable:"false"`
	EtcdLogLevel      ParamItem          `refreshable:"false"`
	EtcdLogPath       ParamItem          `refreshable:"false"`
	EtcdUseSSL        ParamItem          `refreshable:"false"`
	EtcdTLSCert       ParamItem          `refreshable:"false"`
	EtcdTLSKey        ParamItem          `refreshable:"false"`
	EtcdTLSCACert     ParamItem          `refreshable:"false"`
	EtcdTLSMinVersion ParamItem          `refreshable:"false"`

	// --- Embed ETCD ---
	UseEmbedEtcd ParamItem `refreshable:"false"`
	ConfigPath   ParamItem `refreshable:"false"`
	DataDir      ParamItem `refreshable:"false"`
}

///////////////////////////////////////////////////////////////////////////// --- etcd ---

func (*EtcdConfig) Init

func (p *EtcdConfig) Init(base *BaseTable)

type GrpcClientConfig

type GrpcClientConfig struct {
	CompressionEnabled ParamItem `refreshable:"false"`

	ClientMaxSendSize ParamItem `refreshable:"false"`
	ClientMaxRecvSize ParamItem `refreshable:"false"`

	DialTimeout      ParamItem `refreshable:"false"`
	KeepAliveTime    ParamItem `refreshable:"false"`
	KeepAliveTimeout ParamItem `refreshable:"false"`

	MaxAttempts       ParamItem `refreshable:"false"`
	InitialBackoff    ParamItem `refreshable:"false"`
	MaxBackoff        ParamItem `refreshable:"false"`
	BackoffMultiplier ParamItem `refreshable:"false"`
	// contains filtered or unexported fields
}

GrpcClientConfig is configuration for grpc client.

func (*GrpcClientConfig) GetAddress

func (p *GrpcClientConfig) GetAddress() string

GetAddress return grpc address

func (*GrpcClientConfig) GetInternalAddress

func (p *GrpcClientConfig) GetInternalAddress() string

func (*GrpcClientConfig) Init

func (p *GrpcClientConfig) Init(domain string, base *BaseTable)

type GrpcServerConfig

type GrpcServerConfig struct {
	ServerMaxSendSize ParamItem `refreshable:"false"`
	ServerMaxRecvSize ParamItem `refreshable:"false"`
	// contains filtered or unexported fields
}

GrpcServerConfig is configuration for grpc server.

func (*GrpcServerConfig) GetAddress

func (p *GrpcServerConfig) GetAddress() string

GetAddress return grpc address

func (*GrpcServerConfig) GetInternalAddress

func (p *GrpcServerConfig) GetInternalAddress() string

func (*GrpcServerConfig) Init

func (p *GrpcServerConfig) Init(domain string, base *BaseTable)

type KafkaConfig

type KafkaConfig struct {
	Address             ParamItem  `refreshable:"false"`
	SaslUsername        ParamItem  `refreshable:"false"`
	SaslPassword        ParamItem  `refreshable:"false"`
	SaslMechanisms      ParamItem  `refreshable:"false"`
	SecurityProtocol    ParamItem  `refreshable:"false"`
	ConsumerExtraConfig ParamGroup `refreshable:"false"`
	ProducerExtraConfig ParamGroup `refreshable:"false"`
}

--- kafka ---

func (*KafkaConfig) Init

func (k *KafkaConfig) Init(base *BaseTable)

type LocalStorageConfig

type LocalStorageConfig struct {
	Path ParamItem `refreshable:"false"`
}

func (*LocalStorageConfig) Init

func (p *LocalStorageConfig) Init(base *BaseTable)

type MQConfig

type MQConfig struct {
	Type ParamItem `refreshable:"false"`
}

MQConfig represents the configuration settings for the message queue.

func (*MQConfig) Init

func (p *MQConfig) Init(base *BaseTable)

Init initializes the MQConfig object with a BaseTable.

type MetaDBConfig

type MetaDBConfig struct {
	Username     ParamItem `refreshable:"false"`
	Password     ParamItem `refreshable:"false"`
	Address      ParamItem `refreshable:"false"`
	Port         ParamItem `refreshable:"false"`
	DBName       ParamItem `refreshable:"false"`
	MaxOpenConns ParamItem `refreshable:"false"`
	MaxIdleConns ParamItem `refreshable:"false"`
}

///////////////////////////////////////////////////////////////////////////// --- meta db ---

func (*MetaDBConfig) Init

func (p *MetaDBConfig) Init(base *BaseTable)

type MetaStoreConfig

type MetaStoreConfig struct {
	MetaStoreType ParamItem `refreshable:"false"`
}

func (*MetaStoreConfig) Init

func (p *MetaStoreConfig) Init(base *BaseTable)

type MinioConfig

type MinioConfig struct {
	Address         ParamItem `refreshable:"false"`
	Port            ParamItem `refreshable:"false"`
	AccessKeyID     ParamItem `refreshable:"false"`
	SecretAccessKey ParamItem `refreshable:"false"`
	UseSSL          ParamItem `refreshable:"false"`
	BucketName      ParamItem `refreshable:"false"`
	RootPath        ParamItem `refreshable:"false"`
	UseIAM          ParamItem `refreshable:"false"`
	CloudProvider   ParamItem `refreshable:"false"`
	IAMEndpoint     ParamItem `refreshable:"false"`
}

///////////////////////////////////////////////////////////////////////////// --- minio ---

func (*MinioConfig) Init

func (p *MinioConfig) Init(base *BaseTable)

type NatsmqConfig

type NatsmqConfig struct {
	ServerPort                ParamItem `refreshable:"false"`
	ServerStoreDir            ParamItem `refreshable:"false"`
	ServerMaxFileStore        ParamItem `refreshable:"false"`
	ServerMaxPayload          ParamItem `refreshable:"false"`
	ServerMaxPending          ParamItem `refreshable:"false"`
	ServerInitializeTimeout   ParamItem `refreshable:"false"`
	ServerMonitorDebug        ParamItem `refreshable:"false"`
	ServerMonitorLogTime      ParamItem `refreshable:"false"`
	ServerMonitorLogFile      ParamItem `refreshable:"false"`
	ServerMonitorLogSizeLimit ParamItem `refreshable:"false"`
}

NatsmqConfig describes the configuration options for the Nats message queue

func (*NatsmqConfig) Init

func (r *NatsmqConfig) Init(base *BaseTable)

Init sets up a new NatsmqConfig instance using the provided BaseTable

type ParamGroup

type ParamGroup struct {
	KeyPrefix string // which should be named as "A.B."
	Version   string
	Doc       string
	Export    bool

	GetFunc func() map[string]string
	// contains filtered or unexported fields
}

func (*ParamGroup) GetValue

func (pg *ParamGroup) GetValue() map[string]string

func (*ParamGroup) Init

func (pg *ParamGroup) Init(manager *config.Manager)

type ParamItem

type ParamItem struct {
	Key          string // which should be named as "A.B.C"
	Version      string
	Doc          string
	DefaultValue string
	FallbackKeys []string
	PanicIfEmpty bool
	Export       bool

	Formatter func(originValue string) string
	Forbidden bool
	// contains filtered or unexported fields
}

func (*ParamItem) GetAsBool

func (pi *ParamItem) GetAsBool() bool

func (*ParamItem) GetAsDuration

func (pi *ParamItem) GetAsDuration(unit time.Duration) time.Duration

func (*ParamItem) GetAsFloat

func (pi *ParamItem) GetAsFloat() float64

func (*ParamItem) GetAsInt

func (pi *ParamItem) GetAsInt() int

func (*ParamItem) GetAsInt32

func (pi *ParamItem) GetAsInt32() int32

func (*ParamItem) GetAsInt64

func (pi *ParamItem) GetAsInt64() int64

func (*ParamItem) GetAsJSONMap

func (pi *ParamItem) GetAsJSONMap() map[string]string

func (*ParamItem) GetAsStrings

func (pi *ParamItem) GetAsStrings() []string

func (*ParamItem) GetAsUint32

func (pi *ParamItem) GetAsUint32() uint32

func (*ParamItem) GetValue

func (pi *ParamItem) GetValue() string

func (*ParamItem) Init

func (pi *ParamItem) Init(manager *config.Manager)

type PulsarConfig

type PulsarConfig struct {
	Address        ParamItem `refreshable:"false"`
	Port           ParamItem `refreshable:"false"`
	WebAddress     ParamItem `refreshable:"false"`
	WebPort        ParamItem `refreshable:"false"`
	MaxMessageSize ParamItem `refreshable:"true"`

	// support auth
	AuthPlugin ParamItem `refreshable:"false"`
	AuthParams ParamItem `refreshable:"false"`

	// support tenant
	Tenant    ParamItem `refreshable:"false"`
	Namespace ParamItem `refreshable:"false"`
}

///////////////////////////////////////////////////////////////////////////// --- pulsar ---

func (*PulsarConfig) Init

func (p *PulsarConfig) Init(base *BaseTable)

type RocksmqConfig

type RocksmqConfig struct {
	Path          ParamItem `refreshable:"false"`
	LRUCacheRatio ParamItem `refreshable:"false"`
	PageSize      ParamItem `refreshable:"false"`
	// RetentionTimeInMinutes is the time of retention
	RetentionTimeInMinutes ParamItem `refreshable:"false"`
	// RetentionSizeInMB is the size of retention
	RetentionSizeInMB ParamItem `refreshable:"false"`
	// CompactionInterval is the Interval we trigger compaction,
	CompactionInterval ParamItem `refreshable:"false"`
	// TickerTimeInSeconds is the time of expired check, default 10 minutes
	TickerTimeInSeconds ParamItem `refreshable:"false"`
}

///////////////////////////////////////////////////////////////////////////// --- rocksmq ---

func (*RocksmqConfig) Init

func (r *RocksmqConfig) Init(base *BaseTable)

type ServiceParam

type ServiceParam struct {
	BaseTable

	LocalStorageCfg LocalStorageConfig
	MetaStoreCfg    MetaStoreConfig
	EtcdCfg         EtcdConfig
	DBCfg           MetaDBConfig
	MQCfg           MQConfig
	PulsarCfg       PulsarConfig
	KafkaCfg        KafkaConfig
	RocksmqCfg      RocksmqConfig
	NatsmqCfg       NatsmqConfig
	MinioCfg        MinioConfig
}

ServiceParam is used to quickly and easily access all basic service configurations.

func (*ServiceParam) KafkaEnable

func (p *ServiceParam) KafkaEnable() bool

func (*ServiceParam) NatsmqEnable

func (p *ServiceParam) NatsmqEnable() bool

NatsmqEnable checks if NATS messaging queue is enabled.

func (*ServiceParam) PulsarEnable

func (p *ServiceParam) PulsarEnable() bool

func (*ServiceParam) RocksmqEnable

func (p *ServiceParam) RocksmqEnable() bool

type UniqueID

type UniqueID = typeutil.UniqueID

UniqueID is type alias of typeutil.UniqueID

func GetNodeID

func GetNodeID() UniqueID

Jump to

Keyboard shortcuts

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