store

package
v0.0.0-...-ec222d1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2019 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

package defines the general API for a content addressable k/v store and a default implementation using boltdb

Index

Constants

View Source
const (
	DefaultDb = "boris.db"
)

api constants

View Source
const KeySize = sha1.Size

value blob keys are sha1 digests

Variables

View Source
var (
	ExistingErr      = fmt.Errorf("existing entry")
	NotFoundErr      = fmt.Errorf("entry not found")
	DataCorruptedErr = fmt.Errorf("data corrupted")
	DiskFullErr      = fmt.Errorf("disk full error")
	NilValueErr      = fmt.Errorf("nil value error")
	ZeroValueErr     = fmt.Errorf("zero value error")
	InvalidKeyErr    = fmt.Errorf("key is not compliant to spec.")
)

Errors & Warnings

Functions

This section is empty.

Types

type KVStore

type KVStore interface {
	// Adds value blob 'val' to store. Returns computed key.
	Put(val []byte) (Key, error)
	// Gets the specified value for 'key', if any.
	Get(key Key) ([]byte, error)
	// Dels the specified value for 'key', if any.
	Del(key Key) ([]byte, error)
}

type defines the interface for a content addressable k/v store.

type Key

type Key [KeySize]byte

Keys are immutable byte arrays

func (Key) String

func (k Key) String() string

type Store

type Store interface {
	KVStore
	// Closes the store
	Close() error
	Info() ([]byte, error)
}

type defines the general store and data semantics of the storage engine.

func OpenDb

func OpenDb(name string) (Store, error)

Jump to

Keyboard shortcuts

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