config

package
v0.0.0-...-b5aee91 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const CheckpointTypeAuto = "auto"

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckpointConfig

type CheckpointConfig struct {
	Type                    string        `json:"type" yaml:"type"`
	TokenSaveTimeout        time.Duration `json:"saveTimeout" yaml:"saveTimeout"`
	TokenSaveInterval       time.Duration `json:"tokenSaveInterval" yaml:"tokenSaveInterval"`
	ChangeStreamSaveCount   int           `json:"changeStreamSaveCount" yaml:"changeStreamSaveCount"`
	BootstrapSaveCount      int           `json:"bootstrapSaveCount" yaml:"bootstrapSaveCount"`
	BootstrapSaveInterval   time.Duration `json:"bootstrapSaveInterval" yaml:"bootstrapSaveInterval"`
	BootstrapQueryBatchSize int32         `json:"bootstrapQueryBatchSize" yaml:"bootstrapQueryBatchSize"`
	IdleHeartbeatInterval   time.Duration `json:"idleHeartbeatInterval" yaml:"idleHeartbeatInterval"`
	MaxIdleTime             time.Duration `json:"maxIdleTime" yaml:"maxIdleTime"`
}

type Config

type Config struct {
	Partition               PartitionConfig  `json:"partition" yaml:"partition"`
	Logger                  LoggerConfig     `json:"logger" yaml:"logger"`
	MongoDB                 MongoDB          `json:"mongodb" yaml:"mongodb"`
	Checkpoint              CheckpointConfig `json:"checkpoint" yaml:"checkpoint"`
	Metric                  MetricConfig     `json:"metric" yaml:"metric"`
	GracefulShutdownTimeout time.Duration    `json:"gracefulShutdownTimeout" yaml:"gracefulShutdownTimeout"`
}

func ReadConfigJSON

func ReadConfigJSON(filename string) (Config, error)

func ReadConfigYAML

func ReadConfigYAML(filename string) (Config, error)

func (*Config) Print

func (c *Config) Print()

func (*Config) SetDefault

func (c *Config) SetDefault()

func (*Config) Validate

func (c *Config) Validate() error

type Connection

type Connection struct {
	URI        string `json:"uri" yaml:"uri"`
	Username   string `json:"username" yaml:"username"`
	Password   string `json:"password" yaml:"password"`
	Database   string `json:"database" yaml:"database"`
	Collection string `json:"collection" yaml:"collection"`
}

func (*Connection) Validate

func (c *Connection) Validate() error

type ConnectionPool

type ConnectionPool struct {
	MaxPoolSize   uint64 `json:"maxPoolSize" yaml:"maxPoolSize"`
	MinPoolSize   uint64 `json:"minPoolSize" yaml:"minPoolSize"`
	MaxIdleTimeMS int64  `json:"maxIdleTimeMS" yaml:"maxIdleTimeMS"`
}

func (*ConnectionPool) Validate

func (cp *ConnectionPool) Validate() error

type LoggerConfig

type LoggerConfig struct {
	LogLevel string `json:"logLevel" yaml:"logLevel"`
}

type MetricConfig

type MetricConfig struct {
	Port int `json:"port" yaml:"port"`
}

type MongoDB

type MongoDB struct {
	Connection     Connection     `json:"connection" yaml:"connection"`
	Timeouts       Timeouts       `json:"timeouts" yaml:"timeouts"`
	ConnectionPool ConnectionPool `json:"connectionPool" yaml:"connectionPool"`
}

func (*MongoDB) Validate

func (m *MongoDB) Validate() error

type PartitionConfig

type PartitionConfig struct {
	WorkersCollection      string        `json:"workersCollection" yaml:"workersCollection"`
	PartitionsCollection   string        `json:"partitionsCollection" yaml:"partitionsCollection"`
	ConsumerGroup          string        `json:"consumerGroup" yaml:"consumerGroup"`
	HeartbeatInterval      time.Duration `json:"heartbeatInterval" yaml:"heartbeatInterval"`
	WorkerTimeout          time.Duration `json:"workerTimeout" yaml:"workerTimeout"`
	RebalanceCheckInterval time.Duration `json:"rebalanceCheckInterval" yaml:"rebalanceCheckInterval"`
	TotalPartition         int           `json:"totalPartition" yaml:"totalPartition"`
}

func (*PartitionConfig) Validate

func (p *PartitionConfig) Validate() error

type Timeouts

type Timeouts struct {
	ConnectTimeoutMS         int64 `json:"connectTimeoutMS" yaml:"connectTimeoutMS"`
	ServerSelectionTimeoutMS int64 `json:"serverSelectionTimeoutMS" yaml:"serverSelectionTimeoutMS"`
	SocketTimeoutMS          int64 `json:"socketTimeoutMS" yaml:"socketTimeoutMS"`
}

Jump to

Keyboard shortcuts

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