Documentation ¶
Index ¶
- Constants
- type BinaryStreamFileIterator
- type BinaryStreamFileWriter
- type BinaryStreamIterator
- type BinaryStreamWriter
- type DBError
- type HiveKVStoreReader
- func (h *HiveKVStoreReader) Get(key Key) []byte
- func (h *HiveKVStoreReader) Has(key Key) bool
- func (h *HiveKVStoreReader) Iterate(prefix Key, f func(key Key, value []byte) bool)
- func (h *HiveKVStoreReader) IterateKeys(prefix Key, f func(key Key) bool)
- func (h *HiveKVStoreReader) IterateKeysSorted(prefix Key, f func(key Key) bool)
- func (h *HiveKVStoreReader) IterateSorted(prefix Key, f func(key Key, value []byte) bool)
- type Item
- type Items
- type KVIterator
- type KVReader
- type KVStore
- type KVStoreReader
- type KVWriter
- type Key
- type StreamIterator
- type StreamWriter
Constants ¶
const EmptyPrefix = Key("")
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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 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
Get returns the value, or nil if not found
func (*HiveKVStoreReader) Has ¶ added in v0.2.0
func (h *HiveKVStoreReader) Has(key Key) bool
func (*HiveKVStoreReader) Iterate ¶ added in v0.2.0
func (h *HiveKVStoreReader) Iterate(prefix Key, f func(key Key, value []byte) bool)
func (*HiveKVStoreReader) IterateKeys ¶ added in v0.2.0
func (h *HiveKVStoreReader) IterateKeys(prefix Key, f func(key Key) bool)
func (*HiveKVStoreReader) IterateKeysSorted ¶ added in v0.2.0
func (h *HiveKVStoreReader) IterateKeysSorted(prefix Key, f func(key Key) bool)
func (*HiveKVStoreReader) IterateSorted ¶ added in v0.2.0
func (h *HiveKVStoreReader) IterateSorted(prefix Key, f func(key Key, value []byte) bool)
type KVIterator ¶ 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 }
func NewCachedKVStoreReader ¶ added in v1.0.3
func NewCachedKVStoreReader(r KVStoreReader, cacheSize int) KVStoreReader
NewCachedKVStoreReader wraps a KVStoreReader with an in-memory cache. IMPORTANT: there is no logic for cache invalidation, so make sure that the underlying KVStoreReader is never mutated.
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