config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Engine      Engine      `yaml:"engine"`
	Network     Network     `env-prefix:"NETWORK_" yaml:"network"`
	Logging     Logging     `env-prefix:"LOG_"     yaml:"logging"`
	WAL         WAL         `yaml:"wal"`
	Replication Replication `env-prefix:"REPLICA_" yaml:"replication"`
}

type Engine

type Engine struct {
	Type             string `env-default:"in_memory" yaml:"type"`
	PartitionsNumber uint   `env-default:"32"        yaml:"partitions_number"`
}

type Logging

type Logging struct {
	Level  string `env:"LEVEL"  env-default:"info" yaml:"level"`
	Format string `env:"FORMAT" env-default:"text" yaml:"format"`
}

type Network

type Network struct {
	Addr           string        `env:"ADDR"           env-default:":7991"     yaml:"addr"`
	MaxConnections int           `env-default:"100"    yaml:"max_connections"`
	MaxMessageSize int           `env-default:"4096"   yaml:"max_message_size"`
	IdleTimeout    time.Duration `yaml:"idle_timeout"`
	WriteTimeout   time.Duration `yaml:"write_timeout"`
}

func (Network) ServerOptions

func (c Network) ServerOptions() []network.TCPServerOption

type Replication added in v1.2.0

type Replication struct {
	Type         string        `env:"TYPE"        env-default:"master"         yaml:"replica_type"`
	MasterAddr   string        `env:"MASTER_ADDR" env-default:"127.0.0.1:3232" yaml:"master_addr"`
	SyncInterval time.Duration `env-default:"1s"  yaml:"sync_interval"`
	Enabled      bool          `yaml:"enabled"`
}

type WAL added in v1.1.0

type WAL struct {
	FlushBatchSize     int           `env-default:"100"             yaml:"flushing_batch_size"`
	FlushBatchInterval time.Duration `env-default:"10ms"            yaml:"flushing_batch_interval"`
	MaxSegmentSize     int           `env-default:"1048576"         yaml:"max_segment_size"`
	DataDir            string        `env-default:"/data/memdb/wal" yaml:"data_directory"`
	Enabled            bool          `yaml:"enabled"`
}

Jump to

Keyboard shortcuts

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