Documentation ¶
Index ¶
- func ArrayElemKey(name string, idx uint16) kv.Key
- func ArrayRangeKeys(name string, length uint16, from uint16, to uint16) []kv.Key
- func ArraySizeKey(name string) kv.Key
- type Array
- func (a *Array) Erase() error
- func (a *Array) Extend(other *ImmutableArray) error
- func (a *Array) Immutable() *ImmutableArray
- func (a *Array) MustErase()
- func (a *Array) MustExtend(other *ImmutableArray)
- func (a *Array) MustPush(value []byte)
- func (a *Array) MustSetAt(idx uint16, value []byte)
- func (a *Array) Push(value []byte) error
- func (a *Array) SetAt(idx uint16, value []byte) error
- type ImmutableArray
- type ImmutableMap
- func (m *ImmutableMap) GetAt(key []byte) ([]byte, error)
- func (m *ImmutableMap) HasAt(key []byte) (bool, error)
- func (m *ImmutableMap) Iterate(f func(elemKey []byte, value []byte) bool) error
- func (m *ImmutableMap) IterateBalances(f func(color balance.Color, bal int64) bool) error
- func (m *ImmutableMap) IterateKeys(f func(elemKey []byte) bool) error
- func (m *ImmutableMap) Len() (uint32, error)
- func (m *ImmutableMap) MustGetAt(key []byte) []byte
- func (m *ImmutableMap) MustHasAt(key []byte) bool
- func (m *ImmutableMap) MustIterate(f func(elemKey []byte, value []byte) bool)
- func (m *ImmutableMap) MustIterateKeys(f func(elemKey []byte) bool)
- func (m *ImmutableMap) MustLen() uint32
- func (m *ImmutableMap) Name() string
- type ImmutableTimestampedLog
- func (l *ImmutableTimestampedLog) Earliest() (int64, error)
- func (l *ImmutableTimestampedLog) Latest() (int64, error)
- func (l *ImmutableTimestampedLog) Len() (uint32, error)
- func (l *ImmutableTimestampedLog) LoadRecordsRaw(fromIdx, toIdx uint32, descending bool) ([][]byte, error)
- func (l *ImmutableTimestampedLog) MustEarliest() int64
- func (l *ImmutableTimestampedLog) MustLatest() int64
- func (l *ImmutableTimestampedLog) MustLen() uint32
- func (l *ImmutableTimestampedLog) MustLoadRecordsRaw(fromIdx, toIdx uint32, descending bool) [][]byte
- func (l *ImmutableTimestampedLog) MustTakeTimeSlice(fromTs, toTs int64) *TimeSlice
- func (l *ImmutableTimestampedLog) TakeTimeSlice(fromTs, toTs int64) (*TimeSlice, error)
- type Map
- type TimeSlice
- type TimestampedLog
- type TimestampedLogRecord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayRangeKeys ¶
ArrayRangeKeys returns the KVStore keys for the items between [from, to) (`to` being not inclusive), assuming it has `length` elements.
func ArraySizeKey ¶
Types ¶
type Array ¶
type Array struct { *ImmutableArray // contains filtered or unexported fields }
Array represents a dynamic array stored in a kv.KVStore
func (*Array) Extend ¶
func (a *Array) Extend(other *ImmutableArray) error
func (*Array) Immutable ¶
func (a *Array) Immutable() *ImmutableArray
func (*Array) MustExtend ¶
func (a *Array) MustExtend(other *ImmutableArray)
type ImmutableArray ¶
type ImmutableArray struct {
// contains filtered or unexported fields
}
ImmutableArray provides read-only access to an Array in a kv.KVStoreReader.
func NewArrayReadOnly ¶
func NewArrayReadOnly(kv kv.KVStoreReader, name string) *ImmutableArray
func (*ImmutableArray) Len ¶
func (a *ImmutableArray) Len() (uint16, error)
Len == 0/empty/non-existent are equivalent
func (*ImmutableArray) MustGetAt ¶
func (a *ImmutableArray) MustGetAt(idx uint16) []byte
func (*ImmutableArray) MustLen ¶
func (a *ImmutableArray) MustLen() uint16
type ImmutableMap ¶
type ImmutableMap struct {
// contains filtered or unexported fields
}
ImmutableMap provides read-only access to a Map in a kv.KVStoreReader.
func NewMapReadOnly ¶
func NewMapReadOnly(kv kv.KVStoreReader, name string) *ImmutableMap
func (*ImmutableMap) Iterate ¶
func (m *ImmutableMap) Iterate(f func(elemKey []byte, value []byte) bool) error
Iterate non-deterministic
func (*ImmutableMap) IterateBalances ¶
func (*ImmutableMap) IterateKeys ¶
func (m *ImmutableMap) IterateKeys(f func(elemKey []byte) bool) error
Iterate non-deterministic
func (*ImmutableMap) Len ¶
func (m *ImmutableMap) Len() (uint32, error)
func (*ImmutableMap) MustGetAt ¶
func (m *ImmutableMap) MustGetAt(key []byte) []byte
func (*ImmutableMap) MustHasAt ¶
func (m *ImmutableMap) MustHasAt(key []byte) bool
func (*ImmutableMap) MustIterate ¶
func (m *ImmutableMap) MustIterate(f func(elemKey []byte, value []byte) bool)
Iterate non-deterministic
func (*ImmutableMap) MustIterateKeys ¶
func (m *ImmutableMap) MustIterateKeys(f func(elemKey []byte) bool)
Iterate non-deterministic
func (*ImmutableMap) MustLen ¶
func (m *ImmutableMap) MustLen() uint32
func (*ImmutableMap) Name ¶
func (m *ImmutableMap) Name() string
type ImmutableTimestampedLog ¶
type ImmutableTimestampedLog struct {
// contains filtered or unexported fields
}
ImmutableTimestampedLog provides read-only access to a TimestampedLog in a kv.KVStoreReader.
func NewTimestampedLogReadOnly ¶
func NewTimestampedLogReadOnly(kv kv.KVStoreReader, name kv.Key) *ImmutableTimestampedLog
func (*ImmutableTimestampedLog) Earliest ¶
func (l *ImmutableTimestampedLog) Earliest() (int64, error)
Earliest returns timestamp of the first record in the log, if any, or otherwise it is 0
func (*ImmutableTimestampedLog) Latest ¶
func (l *ImmutableTimestampedLog) Latest() (int64, error)
Latest returns latest timestamp in the log
func (*ImmutableTimestampedLog) Len ¶
func (l *ImmutableTimestampedLog) Len() (uint32, error)
func (*ImmutableTimestampedLog) LoadRecordsRaw ¶
func (l *ImmutableTimestampedLog) LoadRecordsRaw(fromIdx, toIdx uint32, descending bool) ([][]byte, error)
LoadRecords returns all records in the slice
func (*ImmutableTimestampedLog) MustEarliest ¶
func (l *ImmutableTimestampedLog) MustEarliest() int64
func (*ImmutableTimestampedLog) MustLatest ¶
func (l *ImmutableTimestampedLog) MustLatest() int64
func (*ImmutableTimestampedLog) MustLen ¶
func (l *ImmutableTimestampedLog) MustLen() uint32
func (*ImmutableTimestampedLog) MustLoadRecordsRaw ¶
func (l *ImmutableTimestampedLog) MustLoadRecordsRaw(fromIdx, toIdx uint32, descending bool) [][]byte
func (*ImmutableTimestampedLog) MustTakeTimeSlice ¶
func (l *ImmutableTimestampedLog) MustTakeTimeSlice(fromTs, toTs int64) *TimeSlice
func (*ImmutableTimestampedLog) TakeTimeSlice ¶
func (l *ImmutableTimestampedLog) TakeTimeSlice(fromTs, toTs int64) (*TimeSlice, error)
TakeTimeSlice returns a slice structure, which contains existing indices firstIdx and lastIdx. Timestamps of all records between indices (inclusive) satisfy the condition >= T(firstIdx) and <=T(lastIdx) Any other pair of indices i1<fistId and/or i2>lastIdx does not satisfy the condition. In other words, returned slice contains all possible indices with timestamps between the two given Returned slice may be empty The algorithm uses binary search with logarithmic complexity.
type Map ¶
type Map struct { *ImmutableMap // contains filtered or unexported fields }
Map represents a dynamic key-value collection in a kv.KVStore.
func (*Map) Immutable ¶
func (m *Map) Immutable() *ImmutableMap
type TimeSlice ¶
type TimeSlice struct {
// contains filtered or unexported fields
}
func (*TimeSlice) FromToIndices ¶
func (*TimeSlice) FromToIndicesCapped ¶
type TimestampedLog ¶
type TimestampedLog struct { *ImmutableTimestampedLog // contains filtered or unexported fields }
TimestampedLog represents a dynamic append-only array of records, where each record is indexed sequentially and consistently timestamped. The sequence of timestamps is considered consistent if for any indices i<j, Ti<=Tj, i.e. non-decreasing
func NewTimestampedLog ¶
func NewTimestampedLog(kv kv.KVStore, name kv.Key) *TimestampedLog
func (*TimestampedLog) Append ¶
func (l *TimestampedLog) Append(ts int64, data []byte) error
Append appends data with timestamp to the end of the log. Returns error if timestamp is inconsistent, i.e. less than the latest timestamp
func (*TimestampedLog) Erase ¶
func (l *TimestampedLog) Erase()
func (*TimestampedLog) Immutable ¶
func (l *TimestampedLog) Immutable() *ImmutableTimestampedLog
func (*TimestampedLog) MustAppend ¶
func (l *TimestampedLog) MustAppend(ts int64, data []byte)
type TimestampedLogRecord ¶
func ParseRawLogRecord ¶
func ParseRawLogRecord(raw []byte) (*TimestampedLogRecord, error)