options

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBdbOptions = &BdbOptions{
	Options: &Options{
		Logger: base.DefaultLogger,
		Cmp:    base.DefaultComparer.Compare,
	},
	Timeout:      0,
	NoGrowSync:   false,
	FreelistType: consts.BdbFreelistArrayType,
}
View Source
var DefaultBitableOptions = &BitableOptions{
	MemTableSize:                consts.BitableMemTableSize,
	MemTableStopWritesThreshold: consts.BitableMemTableStopWritesThreshold,
	L0FileSize:                  consts.BitableL0FileSize,
	CacheSize:                   consts.BitableCacheSize,
	L0CompactionFileThreshold:   consts.BitableL0CompactionFileThreshold,
	L0CompactionThreshold:       consts.BitableL0CompactionThreshold,
	L0StopWritesThreshold:       consts.BitableL0StopWritesThreshold,
	LBaseMaxBytes:               consts.BitableLBaseMaxBytes,
	MaxOpenFiles:                consts.BitableMaxOpenFiles,
}
View Source
var DefaultCheckExpireFunc = func(k, v []byte) bool { return false }
View Source
var DefaultIOWriteLoadThresholdFunc = func() bool {
	return true
}
View Source
var DefaultKeyHashFunc = func(k []byte) int {
	if len(k) < 2 {
		return int(k[0])
	}
	return int(binary.BigEndian.Uint16(k[0:2]))
}
View Source
var DefaultKeyPrefixDeleteFunc = func(k []byte) uint64 {
	return 0
}
View Source
var DefaultKvCheckExpireFunc = func(id int, k, v []byte) bool { return false }
View Source
var DefaultKvTimestampFunc = func(v []byte, t uint8) (bool, uint64) {
	if t == 2 {
		return false, uint64(time.Now().UnixMilli())
	}
	return false, 0
}
View Source
var TestKeyHashFunc = func(k []byte) int {
	return int(binary.BigEndian.Uint16(k[0:2]))
}
View Source
var TestKeyPrefixDeleteFunc = func(k []byte) uint64 {
	if len(k) < 10 {
		return 0
	}
	return binary.LittleEndian.Uint64(k[2:10])
}
View Source
var TestKvCheckExpireFunc = func(id int, k, v []byte) bool {
	if len(v) == 0 {
		return false
	} else if uint8(v[0]) == 1 {
		timestamp := binary.BigEndian.Uint64(v[1:9])
		if timestamp == 0 {
			return false
		}
		if timestamp <= uint64(time.Now().UnixMilli()) {
			return true
		}
		return false
	}

	return false
}
View Source
var TestKvTimestampFunc = func(v []byte, t uint8) (bool, uint64) {
	if t == 2 {
		return false, uint64(time.Now().UnixMilli())
	}

	if uint8(v[0]) != 1 {
		return false, 0
	}

	return true, binary.BigEndian.Uint64(v[1:9])
}

Functions

func NewDefaultDeletionFileLimiter

func NewDefaultDeletionFileLimiter() *base.DeletionFileLimiter

Types

type BdbOptions

type BdbOptions struct {
	*Options
	Index             int
	Timeout           time.Duration
	NoGrowSync        bool
	NoFreelistSync    bool
	FreelistType      string
	ReadOnly          bool
	MmapFlags         int
	InitialMmapSize   int
	PageSize          int
	NoSync            bool
	OpenFile          func(string, int, os.FileMode) (*os.File, error)
	Mlock             bool
	CheckPageSplitted func(uint32) bool
}

type BitableOptions

type BitableOptions struct {
	*Options
	Index                       int
	MemTableSize                int
	MemTableStopWritesThreshold int
	L0CompactionFileThreshold   int
	L0CompactionThreshold       int
	L0StopWritesThreshold       int
	LBaseMaxBytes               int64
	L0FileSize                  int64
	CacheSize                   int64
	MaxOpenFiles                int
	CheckExpireCB               func([]byte, []byte) bool
}

type BithashOptions

type BithashOptions struct {
	*Options
	TableMaxSize int
	Index        int
}

type BitpageOptions

type BitpageOptions struct {
	*Options
	Index           int
	BithashDeleteCB func(uint32) error
	BitableDeleteCB func([]byte) error
	CheckExpireCB   func([]byte, []byte) bool
}

type BitreeOptions

type BitreeOptions struct {
	*Options
	Index              int
	BdbOpts            *BdbOptions
	BitpageOpts        *BitpageOptions
	BithashOpts        *BithashOptions
	BitableOpts        *BitableOptions
	IsFlushedBitableCB func() bool
}

type CacheOptions

type CacheOptions struct {
	Size     int64
	Shards   int
	HashSize int
	Logger   base.Logger
}

type IterOptions

type IterOptions struct {
	LowerBound   []byte
	UpperBound   []byte
	Logger       base.Logger
	SlotId       uint32
	IsAll        bool
	DisableCache bool
}

func (*IterOptions) GetLogger

func (o *IterOptions) GetLogger() base.Logger

func (*IterOptions) GetLowerBound

func (o *IterOptions) GetLowerBound() []byte

func (*IterOptions) GetSlotId

func (o *IterOptions) GetSlotId() uint32

func (*IterOptions) GetUpperBound

func (o *IterOptions) GetUpperBound() []byte

func (*IterOptions) IsGetAll

func (o *IterOptions) IsGetAll() bool

type Options

type Options struct {
	Id                    int
	FS                    vfs.FS
	Cmp                   base.Compare
	Logger                base.Logger
	Compressor            compress.Compressor
	UseBithash            bool
	UseBitable            bool
	UseMapIndex           bool
	UsePrefixCompress     bool
	UseBlockCompress      bool
	BitpageBlockCacheSize int64
	BytesPerSync          int
	KvSeparateSize        int
	BitpageFlushSize      uint64
	BitpageSplitSize      uint64
	BitpageTaskPushFunc   func(*bitask.BitpageTaskData)
	DbState               *statemachine.DbStateMachine
	DeleteFilePacer       *base.DeletionFileLimiter
	KeyHashFunc           func([]byte) int
	KvCheckExpireFunc     func(int, []byte, []byte) bool
	KvTimestampFunc       func([]byte, uint8) (bool, uint64)
	KeyPrefixDeleteFunc   func([]byte) uint64
}

func (*Options) KvCheckExpire

func (o *Options) KvCheckExpire(key, value []byte) bool

type OptionsPool

type OptionsPool struct {
	BaseOptions    *Options
	BitableOptions *BitableOptions
	BithashOptions *BithashOptions
	BitpageOptions *BitpageOptions
	BdbOptions     *BdbOptions
	BitreeOptions  *BitreeOptions
	DbState        *statemachine.DbStateMachine
}

func InitDefaultsOptionsPool

func InitDefaultsOptionsPool() *OptionsPool

func InitTestDefaultsOptionsPool

func InitTestDefaultsOptionsPool() *OptionsPool

func (*OptionsPool) CloneBithashOptions

func (o *OptionsPool) CloneBithashOptions() *BithashOptions

func (*OptionsPool) CloneBitpageOptions

func (o *OptionsPool) CloneBitpageOptions() *BitpageOptions

func (*OptionsPool) CloneBitreeOptions

func (o *OptionsPool) CloneBitreeOptions() *BitreeOptions

func (*OptionsPool) Close

func (o *OptionsPool) Close()

Jump to

Keyboard shortcuts

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