Documentation ¶
Index ¶
- Constants
- func Concat(fragments ...interface{}) []byte
- func DumpKeySet(s map[Key]struct{}) []string
- func GetAllKeys(pref Key, kvr1, kvr2 KVStoreReader) map[Key]struct{}
- func GetAllKeysWithDiff(kvr1, kvr2 KVStoreReader) string
- func GetDiffKeyValues(kvr1, kvr2 KVStoreReader) map[Key]struct{}
- func GetDiffKeys(kvr1, kvr2 KVStoreReader) map[Key]struct{}
- func MustGet(kvs KVStoreReader, key Key) []byte
- func MustHas(kvs KVStoreReader, key Key) bool
- func MustIterate(kvs KVStoreReader, prefix Key, f func(key Key, value []byte) bool)
- func MustIterateKeys(kvs KVStoreReader, prefix Key, f func(key Key) bool)
- func MustIterateKeysSorted(kvs KVStoreReader, prefix Key, f func(key Key) bool)
- func MustIterateSorted(kvs KVStoreReader, prefix Key, f func(key Key, value []byte) bool)
- func NumKeys(kvr KVMustIterator) int
- type BinaryStreamFileIterator
- type BinaryStreamFileWriter
- type BinaryStreamIterator
- type BinaryStreamWriter
- type DBError
- type Diff
- type DiffElement
- type HiveKVStoreReader
- func (h *HiveKVStoreReader) Get(key Key) ([]byte, error)
- func (h *HiveKVStoreReader) Has(key Key) (bool, error)
- func (h *HiveKVStoreReader) Iterate(prefix Key, f func(key Key, value []byte) bool) error
- func (h *HiveKVStoreReader) IterateKeys(prefix Key, f func(key Key) bool) error
- func (h *HiveKVStoreReader) IterateKeysSorted(prefix Key, f func(key Key) bool) error
- func (h *HiveKVStoreReader) IterateSorted(prefix Key, f func(key Key, value []byte) bool) error
- func (h *HiveKVStoreReader) MustGet(key Key) []byte
- func (h *HiveKVStoreReader) MustHas(key Key) bool
- func (h *HiveKVStoreReader) MustIterate(prefix Key, f func(key Key, value []byte) bool)
- func (h *HiveKVStoreReader) MustIterateKeys(prefix Key, f func(key Key) bool)
- func (h *HiveKVStoreReader) MustIterateKeysSorted(prefix Key, f func(key Key) bool)
- func (h *HiveKVStoreReader) MustIterateSorted(prefix Key, f func(key Key, value []byte) bool)
- type Item
- type Items
- type KVIterator
- type KVMustIterator
- type KVMustReader
- type KVReader
- type KVStore
- type KVStoreReader
- type KVWriter
- type Key
- type StreamIterator
- type StreamWriter
Constants ¶
const EmptyPrefix = Key("")
Variables ¶
This section is empty.
Functions ¶
func DumpKeySet ¶ added in v0.3.0
func GetAllKeys ¶ added in v0.3.0
func GetAllKeys(pref Key, kvr1, kvr2 KVStoreReader) map[Key]struct{}
func GetAllKeysWithDiff ¶ added in v0.3.0
func GetAllKeysWithDiff(kvr1, kvr2 KVStoreReader) string
func GetDiffKeyValues ¶ added in v0.3.0
func GetDiffKeyValues(kvr1, kvr2 KVStoreReader) map[Key]struct{}
func GetDiffKeys ¶ added in v0.3.0
func GetDiffKeys(kvr1, kvr2 KVStoreReader) map[Key]struct{}
func MustGet ¶ added in v0.1.0
func MustGet(kvs KVStoreReader, key Key) []byte
func MustHas ¶ added in v0.1.0
func MustHas(kvs KVStoreReader, key Key) bool
func MustIterate ¶ added in v0.1.0
func MustIterate(kvs KVStoreReader, prefix Key, f func(key Key, value []byte) bool)
func MustIterateKeys ¶ added in v0.1.0
func MustIterateKeys(kvs KVStoreReader, prefix Key, f func(key Key) bool)
func MustIterateKeysSorted ¶ added in v0.2.0
func MustIterateKeysSorted(kvs KVStoreReader, prefix Key, f func(key Key) bool)
func MustIterateSorted ¶ added in v0.2.0
func MustIterateSorted(kvs KVStoreReader, prefix Key, f func(key Key, value []byte) bool)
func NumKeys ¶ added in v0.3.0
func NumKeys(kvr KVMustIterator) int
Types ¶
type BinaryStreamFileIterator ¶ added in v0.3.0
type BinaryStreamFileIterator struct { *BinaryStreamIterator File *os.File }
func OpenKVStreamFile ¶ added in v0.3.0
func OpenKVStreamFile(fname string) (*BinaryStreamFileIterator, error)
OpenKVStreamFile opens existing file with k/v stream
type BinaryStreamFileWriter ¶ added in v0.3.0
type BinaryStreamFileWriter struct { *BinaryStreamWriter File *os.File }
func CreateKVStreamFile ¶ added in v0.3.0
func CreateKVStreamFile(fname string) (*BinaryStreamFileWriter, error)
CreateKVStreamFile create a new k/v file
type BinaryStreamIterator ¶ added in v0.3.0
type BinaryStreamIterator struct {
// contains filtered or unexported fields
}
func NewBinaryStreamIterator ¶ added in v0.3.0
func NewBinaryStreamIterator(r io.Reader) *BinaryStreamIterator
type BinaryStreamWriter ¶ added in v0.3.0
type BinaryStreamWriter struct {
// contains filtered or unexported fields
}
BinaryStreamWriter writes stream of k/v pairs in binary format. Keys encoding is 'bytes16' and values is 'bytes32'
func NewBinaryStreamWriter ¶ added in v0.3.0
func NewBinaryStreamWriter(w io.Writer) *BinaryStreamWriter
func (*BinaryStreamWriter) Stats ¶ added in v0.3.0
func (b *BinaryStreamWriter) Stats() (int, int)
func (*BinaryStreamWriter) Write ¶ added in v0.3.0
func (b *BinaryStreamWriter) Write(key, value []byte) error
type Diff ¶ added in v0.3.0
type Diff []*DiffElement
func GetDiff ¶ added in v0.3.0
func GetDiff(kvr1, kvr2 KVStoreReader) Diff
type DiffElement ¶ added in v0.3.0
type HiveKVStoreReader ¶ added in v0.2.0
type HiveKVStoreReader struct {
// contains filtered or unexported fields
}
HiveKVStoreReader is an implementation of KVStoreReader with an instance of hive's kvstore.KVStore as backend.
func NewHiveKVStoreReader ¶ added in v0.2.0
func NewHiveKVStoreReader(db kvstore.KVStore) *HiveKVStoreReader
func (*HiveKVStoreReader) Get ¶ added in v0.2.0
func (h *HiveKVStoreReader) Get(key Key) ([]byte, error)
Get returns the value, or nil if not found
func (*HiveKVStoreReader) Has ¶ added in v0.2.0
func (h *HiveKVStoreReader) Has(key Key) (bool, error)
func (*HiveKVStoreReader) IterateKeys ¶ added in v0.2.0
func (h *HiveKVStoreReader) IterateKeys(prefix Key, f func(key Key) bool) error
func (*HiveKVStoreReader) IterateKeysSorted ¶ added in v0.2.0
func (h *HiveKVStoreReader) IterateKeysSorted(prefix Key, f func(key Key) bool) error
func (*HiveKVStoreReader) IterateSorted ¶ added in v0.2.0
func (*HiveKVStoreReader) MustGet ¶ added in v0.2.0
func (h *HiveKVStoreReader) MustGet(key Key) []byte
MustGet returns the value, or nil if not found
func (*HiveKVStoreReader) MustHas ¶ added in v0.2.0
func (h *HiveKVStoreReader) MustHas(key Key) bool
func (*HiveKVStoreReader) MustIterate ¶ added in v0.2.0
func (h *HiveKVStoreReader) MustIterate(prefix Key, f func(key Key, value []byte) bool)
func (*HiveKVStoreReader) MustIterateKeys ¶ added in v0.2.0
func (h *HiveKVStoreReader) MustIterateKeys(prefix Key, f func(key Key) bool)
func (*HiveKVStoreReader) MustIterateKeysSorted ¶ added in v0.2.0
func (h *HiveKVStoreReader) MustIterateKeysSorted(prefix Key, f func(key Key) bool)
func (*HiveKVStoreReader) MustIterateSorted ¶ added in v0.2.0
func (h *HiveKVStoreReader) MustIterateSorted(prefix Key, f func(key Key, value []byte) bool)
type KVIterator ¶ added in v0.2.0
type KVMustIterator ¶ added in v0.2.0
type KVMustReader ¶ added in v0.2.0
type KVStore ¶
type KVStore interface { KVWriter KVStoreReader }
KVStore represents a key-value store where both keys and values are arbitrary byte slices.
type KVStoreReader ¶ added in v0.1.0
type KVStoreReader interface { KVReader KVIterator KVMustReader KVMustIterator }
type Key ¶
type Key string
Key represents a key in the KVStore, to avoid unnecessary conversions between string and []byte, we use string as key data type, but it does not necessarily have to be a valid UTF-8 string.
type StreamIterator ¶ added in v0.3.0
StreamIterator is an interface to iterate stream