impl

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package impl contains a DB's load/store mechanisms.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrProtoExists occurs when you register a proto that is already registered.
	ErrProtoExists = errors.New("proto exists")

	// ErrUnknownProto occurs when you try to get a proto that is not registered.
	ErrUnknownProto = errors.New("unknown proto")
)
View Source
var ErrClosed = errors.New("impl is closed")

ErrClosed should be returned from any method when an Impl is closed.

Functions

func Add added in v0.5.0

func Add(name string, p Proto)

Add puts the given Proto into the registry. Panics with ErrProtoExists if the name is already registered.

func Del added in v0.5.0

func Del(name string)

Del removes the named Proto from the registry.

func Names added in v0.5.0

func Names() []string

Names returns all of the Proto names in the registry.

Types

type Impl

type Impl interface {
	Keys() ([]string, error)
	Get(k string) ([]byte, error)
	Set(k string, v []byte) error
	Del(k string) error
	Close() error
}

Impl is a generic key-value store backend.

type NoKeyError added in v0.4.1

type NoKeyError struct {
	Key string
	Err error
}

NoKeyError is an error getting a certain key.

func NoKey added in v0.4.1

func NoKey(k string, errs ...error) NoKeyError

NoKey is a convenience function for creating NoKeyErrs.

func (NoKeyError) Error added in v0.4.1

func (n NoKeyError) Error() string

Error implements error.

func (NoKeyError) Unwrap added in v0.4.1

func (n NoKeyError) Unwrap() error

Unwrap for errors.Unwrap.

type Proto added in v0.5.0

type Proto = func(o opts.Opts) (Impl, error)

Proto is a func that opens an Impl with the given Opts.

func Get added in v0.5.0

func Get(name string) (Proto, error)

Get retrieves a Proto from the registry. Returns ErrUnknownProto if the name is not registered.

Directories

Path Synopsis
Package fs contains a filesystem-based Impl.
Package fs contains a filesystem-based Impl.
Package mem contains a very simple in-memory Impl.
Package mem contains a very simple in-memory Impl.
Package table contains an Impl that wraps a given key of another Impl.
Package table contains an Impl that wraps a given key of another Impl.

Jump to

Keyboard shortcuts

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