config

package
v0.0.0-...-1b73a3d Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAddr string = "127.0.0.1:6380"

	DefaultDBName string = "goleveldb"

	DefaultDataDir string = "./var"

	KB int = 1024
	MB int = KB * 1024
	GB int = MB * 1024
)

Variables

View Source
var (
	ErrNoConfigFile = errors.New("Running without a config file")
)

Functions

This section is empty.

Types

type AuthMethod

type AuthMethod func(c *Config, password string) bool

type Config

type Config struct {
	AuthPassword string `toml:"auth_password"`

	//AuthMethod custom authentication method
	AuthMethod AuthMethod `toml:"-"`

	FileName string `toml:"-"`

	// Addr can be empty to assign a local address dynamically
	Addr string `toml:"addr"`

	AddrUnixSocketPerm string `toml:"addr_unixsocketperm"`

	HttpAddr string `toml:"http_addr"`

	SlaveOf string `toml:"slaveof"`

	Readonly bool `toml:"readonly"`

	DataDir string `toml:"data_dir"`

	Databases int `toml:"databases"`

	DBName       string `toml:"db_name"`
	DBPath       string `toml:"db_path"`
	DBSyncCommit int    `toml:"db_sync_commit"`

	LevelDB LevelDBConfig `toml:"leveldb"`
	RocksDB RocksDBConfig `toml:"rocksdb"`

	LMDB LMDBConfig `toml:"lmdb"`

	AccessLog string `toml:"access_log"`

	UseReplication bool              `toml:"use_replication"`
	Replication    ReplicationConfig `toml:"replication"`

	Snapshot SnapshotConfig `toml:"snapshot"`

	ConnReadBufferSize    int `toml:"conn_read_buffer_size"`
	ConnWriteBufferSize   int `toml:"conn_write_buffer_size"`
	ConnKeepaliveInterval int `toml:"conn_keepalive_interval"`

	TTLCheckInterval int `toml:"ttl_check_interval"`

	//tls config
	TLS TLS `toml:"tls"`
	// contains filtered or unexported fields
}

func NewConfigDefault

func NewConfigDefault() *Config

func NewConfigWithData

func NewConfigWithData(data []byte) (*Config, error)

func NewConfigWithFile

func NewConfigWithFile(fileName string) (*Config, error)

func (*Config) Dump

func (cfg *Config) Dump(w io.Writer) error

func (*Config) DumpFile

func (cfg *Config) DumpFile(fileName string) error

func (*Config) GetReadonly

func (cfg *Config) GetReadonly() bool

func (*Config) Rewrite

func (cfg *Config) Rewrite() error

func (*Config) SetReadonly

func (cfg *Config) SetReadonly(b bool)

type LMDBConfig

type LMDBConfig struct {
	MapSize int  `toml:"map_size"`
	NoSync  bool `toml:"nosync"`
}

type LevelDBConfig

type LevelDBConfig struct {
	Compression     bool `toml:"compression"`
	BlockSize       int  `toml:"block_size"`
	WriteBufferSize int  `toml:"write_buffer_size"`
	CacheSize       int  `toml:"cache_size"`
	MaxOpenFiles    int  `toml:"max_open_files"`
	MaxFileSize     int  `toml:"max_file_size"`
}

type ReplicationConfig

type ReplicationConfig struct {
	Path             string `toml:"path"`
	Sync             bool   `toml:"sync"`
	WaitSyncTime     int    `toml:"wait_sync_time"`
	WaitMaxSlaveAcks int    `toml:"wait_max_slave_acks"`
	ExpiredLogDays   int    `toml:"expired_log_days"`
	StoreName        string `toml:"store_name"`
	MaxLogFileSize   int64  `toml:"max_log_file_size"`
	MaxLogFileNum    int    `toml:"max_log_file_num"`
	SyncLog          int    `toml:"sync_log"`
	Compression      bool   `toml:"compression"`
	UseMmap          bool   `toml:"use_mmap"`
	MasterPassword   string `toml:"master_password"`
}

type RocksDBConfig

type RocksDBConfig struct {
	Compression                    int  `toml:"compression"`
	BlockSize                      int  `toml:"block_size"`
	WriteBufferSize                int  `toml:"write_buffer_size"`
	CacheSize                      int  `toml:"cache_size"`
	MaxOpenFiles                   int  `toml:"max_open_files"`
	MaxWriteBufferNum              int  `toml:"max_write_buffer_num"`
	MinWriteBufferNumberToMerge    int  `toml:"min_write_buffer_number_to_merge"`
	NumLevels                      int  `toml:"num_levels"`
	Level0FileNumCompactionTrigger int  `toml:"level0_file_num_compaction_trigger"`
	Level0SlowdownWritesTrigger    int  `toml:"level0_slowdown_writes_trigger"`
	Level0StopWritesTrigger        int  `toml:"level0_stop_writes_trigger"`
	TargetFileSizeBase             int  `toml:"target_file_size_base"`
	TargetFileSizeMultiplier       int  `toml:"target_file_size_multiplier"`
	MaxBytesForLevelBase           int  `toml:"max_bytes_for_level_base"`
	MaxBytesForLevelMultiplier     int  `toml:"max_bytes_for_level_multiplier"`
	DisableAutoCompactions         bool `toml:"disable_auto_compactions"`
	UseFsync                       bool `toml:"use_fsync"`
	MaxBackgroundCompactions       int  `toml:"max_background_compactions"`
	MaxBackgroundFlushes           int  `toml:"max_background_flushes"`
	EnableStatistics               bool `toml:"enable_statistics"`
	StatsDumpPeriodSec             int  `toml:"stats_dump_period_sec"`
	BackgroundThreads              int  `toml:"background_theads"`
	HighPriorityBackgroundThreads  int  `toml:"high_priority_background_threads"`
	DisableWAL                     bool `toml:"disable_wal"`
	MaxManifestFileSize            int  `toml:"max_manifest_file_size"`
}

type SnapshotConfig

type SnapshotConfig struct {
	Path   string `toml:"path"`
	MaxNum int    `toml:"max_num"`
}

type TLS

type TLS struct {
	Enabled     bool   `toml:"enabled"`
	Certificate string `toml:"certificate"`
	Key         string `toml:"key"`
}

Jump to

Keyboard shortcuts

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