bitcask

package module
v0.0.0-...-4216104 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: MIT Imports: 13 Imported by: 0

README

Bitcask

Bitcask is a log-structured fast KV store.

This project is an implementation of Bitcask written in Go.

Bitcask intro here

Example

package main

import (
	"github.com/qichengzx/bitcask"
	"log"
)

func main() {
	d, err := bitcask.New("your/path/here")
	if err != nil {
		log.Fatal(err)
	}
	defer d.Close()

	d.Put([]byte("bitcask"), []byte("bitcask is a log-structured fast KV store"))
	v, _ := d.Get([]byte("bitcask"))
	log.Println(string(v))
}

Documentation

Index

Constants

View Source
const HeaderSize = 16
View Source
const (
	HintHeaderSize = 16
)

Variables

View Source
var (
	ErrKeyNotFound = errors.New("key not found")
)

Functions

This section is empty.

Types

type BitFile

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

type BitFiles

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

type Bitcask

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

func New

func New(dir string) (*Bitcask, error)

func (*Bitcask) Close

func (b *Bitcask) Close()

func (*Bitcask) Del

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

func (*Bitcask) Get

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

func (*Bitcask) Put

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

type FileLock

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

func AcquireFileLock

func AcquireFileLock(path string, readOnly bool) (*FileLock, error)

func (*FileLock) Release

func (fl *FileLock) Release() error

type HintHeader

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

type Option

type Option struct {
	Dir         string
	MaxFileSize uint64
	MergeSecs   int
}

func NewOption

func NewOption(dir string, MaxFileSize uint64) Option

Jump to

Keyboard shortcuts

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