Documentation
¶
Overview ¶
Package tree implements an observed-remove rooted tree CRDT.
Index ¶
- Variables
- type Delta
- type Node
- type NodeID
- type ORTree
- func (t *ORTree) Add(parent NodeID, value []byte) (NodeID, Delta, error)
- func (t *ORTree) ApplyDelta(delta Delta) error
- func (t *ORTree) ClockState() clock.State
- func (t *ORTree) MarshalBinary() ([]byte, error)
- func (t *ORTree) MarshalBinaryWithClockState() ([]byte, clock.State, error)
- func (t *ORTree) MarshalJSON() ([]byte, error)
- func (t *ORTree) Merge(other *ORTree) error
- func (t *ORTree) Nodes() []Node
- func (t *ORTree) Remove(id NodeID) (Delta, error)
- func (t *ORTree) SnapshotCurrentState() (snapshot.Snapshot, error)
- func (t *ORTree) State() crdt.StateSnapshot
- func (t *ORTree) UnmarshalBinary(data []byte) error
- func (t *ORTree) UnmarshalBinaryWithLimits(data []byte, limits frame.DecoderLimits) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidReplicaID = errors.New("tree: invalid replica ID") ErrNilTree = errors.New("tree: nil OR-Tree") ErrUnknownParent = errors.New("tree: unknown live parent") ErrUnknownNode = errors.New("tree: unknown live node") ErrInvalidDelta = errors.New("tree: invalid delta") ErrIncompleteState = errors.New("tree: incomplete OR-Tree state") ErrNodeConflict = errors.New("tree: conflicting node identity") )
Functions ¶
This section is empty.
Types ¶
type Delta ¶
type Delta struct {
// contains filtered or unexported fields
}
func UnmarshalDelta ¶
func UnmarshalDeltaWithLimits ¶
func UnmarshalDeltaWithLimits(data []byte, limits frame.DecoderLimits) (Delta, error)
func (Delta) MarshalBinary ¶
func (Delta) MarshalJSON ¶ added in v1.0.5
MarshalJSON returns a diagnostic summary for structured logs. It omits node values, identities, tombstone identities, and clock state.
type ORTree ¶
type ORTree struct {
// contains filtered or unexported fields
}
ORTree supports add and observed-remove. Moving a node is deliberately not an in-place operation: remove it and add a new instance under the new parent.
func (*ORTree) ApplyDelta ¶
func (*ORTree) ClockState ¶
func (*ORTree) MarshalBinary ¶
MarshalBinary returns a deterministic, bounded framed OR-Tree state.
func (*ORTree) MarshalBinaryWithClockState ¶
func (*ORTree) MarshalJSON ¶ added in v1.0.5
MarshalJSON returns a diagnostic summary for structured logs. It omits node values, identities, tombstone identities, and clock state.
func (*ORTree) SnapshotCurrentState ¶
func (*ORTree) State ¶
func (t *ORTree) State() crdt.StateSnapshot
func (*ORTree) UnmarshalBinary ¶
UnmarshalBinary validates the full state before atomically replacing t. Complete states additionally require every non-root parent to be present.
func (*ORTree) UnmarshalBinaryWithLimits ¶
func (t *ORTree) UnmarshalBinaryWithLimits(data []byte, limits frame.DecoderLimits) error