Documentation ¶
Overview ¶
Package cindex provides an interface and implementation for getting/saving consistentIndex.
Index ¶
- Variables
- func CreateMetaBucket(tx backend.BatchTx)
- func ReadConsistentIndex(tx backend.ReadTx) (uint64, uint64)
- func UnsafeCreateMetaBucket(tx backend.BatchTx)
- func UnsafeUpdateConsistentIndex(tx backend.BatchTx, index uint64, term uint64, onlyGrow bool)
- func UpdateConsistentIndex(tx backend.BatchTx, index uint64, term uint64, onlyGrow bool)
- type Backend
- type ConsistentIndexer
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MetaBucketName = []byte("meta") ConsistentIndexKeyName = []byte("consistent_index") TermKeyName = []byte("term") )
Functions ¶
func CreateMetaBucket ¶
CreateMetaBucket creates the `meta` bucket (if it does not exists yet).
func ReadConsistentIndex ¶
ReadConsistentIndex loads consistent index and term from given transaction. returns 0 if the data are not found.
func UnsafeCreateMetaBucket ¶
UnsafeCreateMetaBucket creates the `meta` bucket (if it does not exists yet).
Types ¶
type ConsistentIndexer ¶
type ConsistentIndexer interface { // ConsistentIndex returns the consistent index of current executing entry. ConsistentIndex() uint64 // SetConsistentIndex set the consistent index of current executing entry. SetConsistentIndex(v uint64, term uint64) // UnsafeSave must be called holding the lock on the tx. // It saves consistentIndex to the underlying stable storage. UnsafeSave(tx backend.BatchTx) // SetBackend set the available backend.BatchTx for ConsistentIndexer. SetBackend(be Backend) }
ConsistentIndexer is an interface that wraps the Get/Set/Save method for consistentIndex.
func NewConsistentIndex ¶
func NewConsistentIndex(be Backend) ConsistentIndexer
NewConsistentIndex creates a new consistent index. If `be` is nil, it must be set (SetBackend) before first access using `ConsistentIndex()`.
func NewFakeConsistentIndex ¶
func NewFakeConsistentIndex(index uint64) ConsistentIndexer
Click to show internal directories.
Click to hide internal directories.