Home Download Docs Code Community
import "perkeep/pkg/sorted/buffer"
Overview
Index

Overview ▾

Package buffer provides a sorted.KeyValue implementation that buffers one KeyValue implementation in front of an another. It's used for cases such as reindexing where you need a KeyValue but it doesn't need to be flushed and consistent until the end.

Index

type KeyValue
    func New(buffer, backing sorted.KeyValue, maxBufferBytes int64) *KeyValue
    func (kv *KeyValue) BeginBatch() sorted.BatchMutation
    func (kv *KeyValue) Close() error
    func (kv *KeyValue) CommitBatch(bm sorted.BatchMutation) error
    func (kv *KeyValue) Delete(key string) error
    func (kv *KeyValue) Find(start, end string) sorted.Iterator
    func (kv *KeyValue) Flush() error
    func (kv *KeyValue) Get(key string) (string, error)
    func (kv *KeyValue) Set(key, value string) error

Package files

buffer.go

type KeyValue

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

func New

func New(buffer, backing sorted.KeyValue, maxBufferBytes int64) *KeyValue

New returns a sorted.KeyValue implementation that adds a Flush method to flush the buffer to the backing storage. A flush will also be performed when maxBufferBytes are reached. If maxBufferBytes <= 0, no automatic flushing is performed.

func (*KeyValue) BeginBatch

func (kv *KeyValue) BeginBatch() sorted.BatchMutation

func (*KeyValue) Close

func (kv *KeyValue) Close() error

func (*KeyValue) CommitBatch

func (kv *KeyValue) CommitBatch(bm sorted.BatchMutation) error

func (*KeyValue) Delete

func (kv *KeyValue) Delete(key string) error

func (*KeyValue) Find

func (kv *KeyValue) Find(start, end string) sorted.Iterator

func (*KeyValue) Flush

func (kv *KeyValue) Flush() error

func (*KeyValue) Get

func (kv *KeyValue) Get(key string) (string, error)

func (*KeyValue) Set

func (kv *KeyValue) Set(key, value string) error
Website layout inspired by memcached.
Content by the authors.