config

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2025 License: BSD-3-Clause Imports: 9 Imported by: 3

Documentation

Index

Constants

View Source
const (
	IOBufferLength                   int           = 512
	EvictionRatio                    float64       = 0.9
	DefaultKeysLimit                 int           = 200000000
	WatchChanBufSize                 int           = 20000
	ShardCronFrequency               time.Duration = 1 * time.Second
	AdhocReqChanBufSize              int           = 20
	EnableProfile                    bool          = false
	WebSocketWriteResponseTimeout    time.Duration = 10 * time.Second
	WebSocketMaxWriteResponseRetries int           = 3

	KeepAlive int32 = 300
	Timeout   int32 = 300

	DefaultConnBacklogSize = 128

	MaxRequestSize = 32 * 1024 * 1024 // 32 MB
	IoBufferSize   = 16 * 1024        // 16 KB
	IdleTimeout    = 30 * time.Minute
)

Variables

View Source
var (
	DiceDBVersion = "-"
)
View Source
var MetadataDir = "/etc/dicedb/"

Functions

func ForceInit

func ForceInit(config *DiceDBConfig)

func InitConfig

func InitConfig(flags *pflag.FlagSet)

InitConfig initializes the config file. If the config file does not exist, it creates a new one. If the config file exists, it overwrites the existing config with the new key-values. and overwrite should replace the existing config with the new key-values and default values. If the metadata direcoty is inaccessible, then it uses the current working directory as the metadata directory.

func Load

func Load(flags *pflag.FlagSet)

Types

type DiceDBConfig

type DiceDBConfig struct {
	Host string `mapstructure:"host" default:"0.0.0.0" description:"the host address to bind to"`
	Port int    `mapstructure:"port" default:"7379" description:"the port to bind to"`

	Username string `mapstructure:"username" default:"dicedb" description:"the username to use for authentication"`
	Password string `mapstructure:"password" default:"" description:"the password to use for authentication"`

	LogLevel string `mapstructure:"log-level" default:"info" description:"the log level"`

	EnableWatch bool `mapstructure:"enable-watch" default:"false" description:"enable support for .WATCH commands and real-time reactivity"`
	MaxClients  int  `mapstructure:"max-clients" default:"20000" description:"the maximum number of clients to accept"`
	NumShards   int  `mapstructure:"num-shards" default:"-1" description:"number of shards to create. defaults to number of cores"`

	Engine string `mapstructure:"engine" default:"ironhawk" description:"the engine to use, values: ironhawk"`

	EnableWAL                         bool   `mapstructure:"enable-wal" default:"false" description:"enable write-ahead logging"`
	WALDir                            string `mapstructure:"wal-dir" default:"/var/log/dicedb" description:"the directory to store WAL segments"`
	WALMode                           string `mapstructure:"wal-mode" default:"buffered" description:"wal mode to use, values: buffered, unbuffered"`
	WALWriteMode                      string `mapstructure:"wal-write-mode" default:"default" description:"wal file write mode to use, values: default, fsync"`
	WALBufferSizeMB                   int    `mapstructure:"wal-buffer-size-mb" default:"1" description:"the size of the wal write buffer in megabytes"`
	WALRotationMode                   string `mapstructure:"wal-rotation-mode" default:"segment-size" description:"wal rotation mode to use, values: segment-size, time"`
	WALMaxSegmentSizeMB               int    `` /* 133-byte string literal not displayed */
	WALMaxSegmentRotationTimeSec      int    `` /* 143-byte string literal not displayed */
	WALBufferSyncIntervalMillis       int    `` /* 149-byte string literal not displayed */
	WALRetentionMode                  string `` /* 155-byte string literal not displayed */
	WALMaxSegmentCount                int    `` /* 145-byte string literal not displayed */
	WALMaxSegmentRetentionDurationSec int    `` /* 142-byte string literal not displayed */
	WALRecoveryMode                   string `` /* 139-byte string literal not displayed */
}
var Config *DiceDBConfig

Jump to

Keyboard shortcuts

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