Documentation ¶
Overview ¶
Package store defines Store, a key-value CRDT store.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
func (*Log) Head ¶
func (l *Log) Head() *common.VersionVector
Head returns a new version vector representing current knowledge. cond.L must be held.
func (*Log) NewIterator ¶
func (l *Log) NewIterator(vec *common.VersionVector) *LogIterator
NewIterator returns an iterator for patches beyond the given version vector. Iteration order matches log order. cond.L must be held during calls to Advance, but need not be held at other times.
func (*Log) Wait ¶
func (l *Log) Wait(vec *common.VersionVector)
Wait blocks until the log has patches beyond the given version vector. cond.L must not be held.
type LogIterator ¶
type LogIterator struct {
// contains filtered or unexported fields
}
func (*LogIterator) Advance ¶
func (it *LogIterator) Advance() bool
Advance advances the iterator, staging the next patch. Must be called to stage the first value. Assumes cond.L is held.
func (*LogIterator) AgentId ¶
func (it *LogIterator) AgentId() uint32
AgentId returns the agent id for the current patch.
func (*LogIterator) AgentSeq ¶
func (it *LogIterator) AgentSeq() uint32
AgentSeq returns the agent sequence number for the current patch.
func (*LogIterator) Err ¶
func (it *LogIterator) Err() error
Err returns a non-nil error iff the iterator encountered an error.
func (*LogIterator) Patch ¶
func (it *LogIterator) Patch() *PatchEnvelope
Value returns the current patch.
func (*LogIterator) VersionVector ¶
func (it *LogIterator) VersionVector() *common.VersionVector
VersionVector returns a copy of the current version vector, representing which patches the client has already seen.
type PatchEnvelope ¶
type PatchEnvelope struct { LocalSeq uint32 // one-based position in local, cross-agent patch log Key string DType string Patch string // encoded }
PatchEnvelope represents a patch and its associated metadata. Key is of the form [AgentId]:[AgentSeq], where AgentId is the creator's agent id and [AgentSeq] is the creator's sequence number for this patch.
type Store ¶
type Store struct { Log *Log // contains filtered or unexported fields }
func (*Store) ApplyClientPatch ¶
ApplyClientPatch applies the given encoded patch and returns the local sequence number for the written log record. Mutex must be held.
func (*Store) ApplyServerPatch ¶
ApplyServerPatch applies the given encoded patch, if needed. Mutex must be held.
func (*Store) NewIterator ¶
func (s *Store) NewIterator() *StoreIterator
NewIterator returns an iterator for stored key-value pairs. Iteration order matches lexicographic key order. The store must not be modified while the iterator is in use.
type StoreIterator ¶
type StoreIterator struct {
// contains filtered or unexported fields
}
func (*StoreIterator) Advance ¶
func (it *StoreIterator) Advance() bool
Advance advances the iterator, staging the next value. Must be called to stage the first value.
func (*StoreIterator) Err ¶
func (it *StoreIterator) Err() error
Err returns a non-nil error iff the iterator encountered an error.
func (*StoreIterator) Value ¶
func (it *StoreIterator) Value() *ValueEnvelope
Value returns the current value.
type ValueEnvelope ¶
ValueEnvelope represents a value and its associated metadata. Key is of the form [Key], where Key is the object key.