kvdb

package
v0.2.14 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: BSD-3-Clause Imports: 2 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch interface {
	Put(key string, value []byte) error
	Delete(key string) error
	Commit() error
}

type Factory

type Factory interface {
	New(logger log.StandardLogger, path string, rebroadcastIntervalSec int) (s KVDB, err error)
	Close()
}

type KVDB

type KVDB interface {
	// Get will retrieve the key indexed data
	Get(ctx context.Context, key string) ([]byte, error)

	// Put will insert the data, indexed by key
	Put(ctx context.Context, key string, v []byte) error

	// Delete deletes the key and index data
	Delete(ctx context.Context, key string) error

	// List will list all keys with the given prefix
	List(ctx context.Context, prefix string) ([]string, error)

	// ListAsync returns a channel to list to listed keys
	ListAsync(ctx context.Context, prefix string) (chan string, error)

	// ListRegex will list all keys matching the given prefix, and regexs
	ListRegEx(ctx context.Context, prefix string, regexs ...string) ([]string, error)

	// ListRegexAsync will return a channel to list all regex matched keys
	ListRegExAsync(ctx context.Context, prefix string, regexs ...string) (chan string, error)

	// Batch creates a Batch interface of the current KVDB
	Batch(ctx context.Context) (Batch, error)

	// Sync syncs the KVDB key values
	Sync(ctx context.Context, key string) error

	Factory() Factory

	// Closes the KVDB
	Close()
}

Jump to

Keyboard shortcuts

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