Documentation ¶
Index ¶
- func Array16RangeKeys(name string, length, from, to uint16) []kv.Key
- func Array32RangeKeys(name string, length, from, to uint32) []kv.Key
- type Array16
- func (a *Array16) Erase() error
- func (a *Array16) Extend(other *ImmutableArray16) error
- func (a *Array16) Immutable() *ImmutableArray16
- func (a *Array16) MustErase()
- func (a *Array16) MustExtend(other *ImmutableArray16)
- func (a *Array16) MustPush(value []byte)
- func (a *Array16) MustSetAt(idx uint16, value []byte)
- func (a *Array16) Push(value []byte) error
- func (a *Array16) SetAt(idx uint16, value []byte) error
- type Array32
- func (a *Array32) Erase() error
- func (a *Array32) Extend(other *ImmutableArray32) error
- func (a *Array32) Immutable() *ImmutableArray32
- func (a *Array32) MustErase()
- func (a *Array32) MustExtend(other *ImmutableArray32)
- func (a *Array32) MustPush(value []byte)
- func (a *Array32) MustSetAt(idx uint32, value []byte)
- func (a *Array32) Push(value []byte) error
- func (a *Array32) SetAt(idx uint32, value []byte) error
- type ImmutableArray16
- type ImmutableArray32
- 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) 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) MustIterateBalances(f func(color colored.Color, bal uint64) 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 Array16RangeKeys ¶ added in v0.2.0
Array16RangeKeys returns the KVStore keys for the items between [from, to) (`to` being not inclusive), assuming it has `length` elements.
Types ¶
type Array16 ¶ added in v0.2.0
type Array16 struct { *ImmutableArray16 // contains filtered or unexported fields }
Array16 represents a dynamic array stored in a kv.KVStore
func (*Array16) Extend ¶ added in v0.2.0
func (a *Array16) Extend(other *ImmutableArray16) error
func (*Array16) Immutable ¶ added in v0.2.0
func (a *Array16) Immutable() *ImmutableArray16
func (*Array16) MustExtend ¶ added in v0.2.0
func (a *Array16) MustExtend(other *ImmutableArray16)
type Array32 ¶ added in v0.2.0
type Array32 struct { *ImmutableArray32 // contains filtered or unexported fields }
Array32 represents a dynamic array stored in a kv.KVStore
func (*Array32) Extend ¶ added in v0.2.0
func (a *Array32) Extend(other *ImmutableArray32) error
func (*Array32) Immutable ¶ added in v0.2.0
func (a *Array32) Immutable() *ImmutableArray32
func (*Array32) MustExtend ¶ added in v0.2.0
func (a *Array32) MustExtend(other *ImmutableArray32)
type ImmutableArray16 ¶ added in v0.2.0
type ImmutableArray16 struct {
// contains filtered or unexported fields
}
ImmutableArray16 provides read-only access to an Array16 in a kv.KVStoreReader.
func NewArray16ReadOnly ¶ added in v0.2.0
func NewArray16ReadOnly(kvReader kv.KVStoreReader, name string) *ImmutableArray16
func (*ImmutableArray16) GetAt ¶ added in v0.2.0
func (a *ImmutableArray16) GetAt(idx uint16) ([]byte, error)
func (*ImmutableArray16) Len ¶ added in v0.2.0
func (a *ImmutableArray16) Len() (uint16, error)
Len == 0/empty/non-existent are equivalent
func (*ImmutableArray16) MustGetAt ¶ added in v0.2.0
func (a *ImmutableArray16) MustGetAt(idx uint16) []byte
func (*ImmutableArray16) MustLen ¶ added in v0.2.0
func (a *ImmutableArray16) MustLen() uint16
type ImmutableArray32 ¶ added in v0.2.0
type ImmutableArray32 struct {
// contains filtered or unexported fields
}
ImmutableArray32 provides read-only access to an Array32 in a kv.KVStoreReader.
func NewArray32ReadOnly ¶ added in v0.2.0
func NewArray32ReadOnly(kvReader kv.KVStoreReader, name string) *ImmutableArray32
func (*ImmutableArray32) GetAt ¶ added in v0.2.0
func (a *ImmutableArray32) GetAt(idx uint32) ([]byte, error)
func (*ImmutableArray32) Len ¶ added in v0.2.0
func (a *ImmutableArray32) Len() (uint32, error)
Len == 0/empty/non-existent are equivalent
func (*ImmutableArray32) MustGetAt ¶ added in v0.2.0
func (a *ImmutableArray32) MustGetAt(idx uint32) []byte
func (*ImmutableArray32) MustLen ¶ added in v0.2.0
func (a *ImmutableArray32) MustLen() uint32
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(kvReader 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) 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) MustIterateBalances ¶ added in v0.2.0
func (m *ImmutableMap) MustIterateBalances(f func(color colored.Color, bal uint64) bool)
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(kvReader 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(kvStore 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)