bitcaskstore

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

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

Go to latest
Published: Jan 20, 2025 License: MIT Imports: 7 Imported by: 1

README

bitcaskstore

GoDoc CI

Package bitcaskstore implements the blob.Store interface using Bitcask.

Documentation

Overview

Package bitcaskstore implements the blob.StoreCloser interface on a bitcask database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Opener

func Opener(_ context.Context, addr string) (blob.StoreCloser, error)

Opener constructs a bitcaskstore from a path address.

Types

type KV

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

KV implements the blob.KV interface on a bitcask database.

func (KV) Close

func (s KV) Close(_ context.Context) error

Close implements part of the blob.KV interface. It syncs and closes all of the data files in use by the database.

func (KV) Delete

func (s KV) Delete(ctx context.Context, key string) error

Delete implements part of blob.KV.

func (KV) Get

func (s KV) Get(ctx context.Context, key string) ([]byte, error)

Get implements part of blob.KV.

func (KV) Has

func (s KV) Has(ctx context.Context, keys ...string) (blob.KeySet, error)

Has implements part of blob.KV.

func (KV) Len

func (s KV) Len(ctx context.Context) (n int64, err error)

Len implements part of blob.KV.

func (KV) List

func (s KV) List(ctx context.Context, start string) iter.Seq2[string, error]

List implements part of blob.KV.

func (KV) Put

func (s KV) Put(ctx context.Context, opts blob.PutOptions) error

Put implements part of blob.KV. The bitcask implementation does not accept empty keys, so Put will report blob.ErrKeyNotFound for that case.

type Options

type Options struct {
	// KeyPrefix, if set, restricts access to keys beginning with this prefix.
	KeyPrefix string
}

Options are configurations for a KV or a Store. A nil *Options is ready for use and provides default values as described.

type Store

type Store struct {
	*monitor.M[*bitcask.Bitcask, KV]
}

Store implements the blob.StoreCloser interface using a Bitcask database.

func New

func New(path string, opts *Options) (Store, error)

New constructs a Store by opening or creating a Bitcask database with the specified path and options.

func (Store) Close

func (s Store) Close(_ context.Context) error

Close implements part of the blob.StoreCloser interface.

Jump to

Keyboard shortcuts

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