leveldb

package
v0.0.0-...-c353a70 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LevelDBBackend

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

LevelDBBackend provides access to the leveldb store.

func New

func New(path string) (*LevelDBBackend, error)

New instantiates a new LevelDBBackend

func (*LevelDBBackend) Close

func (backend *LevelDBBackend) Close() error

Close the resources associated with this backend.

func (*LevelDBBackend) Del

func (backend *LevelDBBackend) Del(ctx context.Context, key string) error

Del removes an existing shortcut from the data store.

func (*LevelDBBackend) Get

func (backend *LevelDBBackend) Get(ctx context.Context, name string) (*internal.Route, error)

Get retreives a shortcut from the data store.

func (*LevelDBBackend) GetAll

func (backend *LevelDBBackend) GetAll(ctx context.Context) (map[string]internal.Route, error)

GetAll gets everything in the db to dump it out for backup purposes

func (*LevelDBBackend) List

func (backend *LevelDBBackend) List(ctx context.Context, start string) (internal.RouteIterator, error)

List all routes in an iterator, starting with the key prefix of start (which can also be nil).

func (*LevelDBBackend) NextID

func (backend *LevelDBBackend) NextID(ctx context.Context) (uint64, error)

NextID generates the next numeric ID to be used for an auto-named shortcut.

func (*LevelDBBackend) Put

func (backend *LevelDBBackend) Put(ctx context.Context, key string, rt *internal.Route) error

Put stores a new shortcut in the data store.

type LevelDBRouteIterator

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

Iter allows iteration of the named routes in the store.

func (*LevelDBRouteIterator) Error

func (i *LevelDBRouteIterator) Error() error

Error returns any active error that has stopped the iterator.

func (*LevelDBRouteIterator) Name

func (i *LevelDBRouteIterator) Name() string

Name is the name of the current route.

func (*LevelDBRouteIterator) Next

func (i *LevelDBRouteIterator) Next() bool

Next advances the iterator to the next value.

func (*LevelDBRouteIterator) Release

func (i *LevelDBRouteIterator) Release()

Release disposes of the resources in the iterator.

func (*LevelDBRouteIterator) Route

func (i *LevelDBRouteIterator) Route() *internal.Route

Route is the current route.

func (*LevelDBRouteIterator) Seek

func (i *LevelDBRouteIterator) Seek(cur string) bool

Seek ...

func (*LevelDBRouteIterator) Valid

func (i *LevelDBRouteIterator) Valid() bool

Valid indicates whether the current values of the iterator are valid.

Jump to

Keyboard shortcuts

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