leveldbstore

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

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 10 Imported by: 1

README

leveldbstore

GoDoc CI

Package leveldbstore implements the blob.Store interface using LevelDB.

Documentation

Overview

Package leveldbstore implements the blob.StoreCloser interface on LevelDB.

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 leveldbstore from an address comprising a path, for use with the store package.

Types

type KV

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

A KV implements the blob.KV interface backed by a LevelDB file.

func (KV) Delete

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

Delete implements the corresponding method of the blob.KV interface.

func (KV) Get

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

Get implements the corresponding method of the blob.KV interface.

func (KV) Has

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

Has implements the corresponding method of the blob.KV interface.

func (KV) Len

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

Len implements the corresponding method of the blob.KV interface.

func (KV) List

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

List implements the corresponding method of the blob.KV interface.

func (KV) Put

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

Put implements the corresponding method of the blob.KV interface.

type Options

type Options struct {
	Create bool // create the database if it does not exist
}

Options provide optional settings for opening and creating a KV.

type Store

type Store struct {
	*monitor.M[*leveldb.DB, KV]
}

Store implements the blob.StoreCloser interface over a LevelDB instance.

func New

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

New opens a LevelDB database at path and returns a store associated with that database.

func (Store) Close

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

Close implements part of the blob.StoreCloser interface, it closes the underlying LevelDB file.

Jump to

Keyboard shortcuts

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