bitcask

package module
v0.0.0-...-417a8f3 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2021 License: MIT Imports: 19 Imported by: 0

README

bitcask

learning bitcask

Documentation

Index

Constants

View Source
const (
	DefaultMaxDatafileSize         = 1 << 20 // 1MB
	DefaultDirFileModeBeforeUmask  = os.FileMode(0700)
	DefaultFileFileModeBeforeUmask = os.FileMode(0600)
	DefaultMaxKeySize              = uint32(64)
	DefaultMaxValueSize            = uint64(1 << 16) // 65K
	DefaultSync                    = false
	CurrentDBVersion               = uint32(1)
)

Variables

View Source
var (
	ErrEmptyKey        = errors.New("empty key")
	ErrLargeKey        = errors.New("large key")
	ErrLargeValue      = errors.New("large value")
	ErrKeyNotFound     = errors.New("error: key not found")
	ErrKeyExpired      = errors.New("error: key expired")
	ErrChecksumFailed  = errors.New("error: checksum failed")
	ErrMergeInProgress = errors.New("error: merge in progress")
	ErrDatabaseLocked  = errors.New("error: database locked")
)

Functions

This section is empty.

Types

type Bitcask

type Bitcask struct {
	// contains filtered or unexported fields
}

func New

func New() *Bitcask

func Open

func Open(path string, options ...Option) (*Bitcask, error)

func (*Bitcask) Close

func (b *Bitcask) Close() error

func (*Bitcask) Delete

func (b *Bitcask) Delete(key []byte) error

func (*Bitcask) Fold

func (b *Bitcask) Fold(f func(key []byte) error) (err error)

func (*Bitcask) Get

func (b *Bitcask) Get(key []byte) ([]byte, error)

func (*Bitcask) Merge

func (b *Bitcask) Merge() error

合并所有datafile,将旧key和已被删除的key删除

func (*Bitcask) Put

func (b *Bitcask) Put(key, value []byte) error

将kv写入到数据库

func (*Bitcask) Reopen

func (b *Bitcask) Reopen() error

func (*Bitcask) RunGC

func (b *Bitcask) RunGC() error

删除所有过期的key

type Option

type Option func(*config.Config) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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