Documentation ¶
Index ¶
- Variables
- type GCounter
- type GSet
- func (gs *GSet) Clone() *GSet
- func (gs *GSet) Compare(other *GSet) bool
- func (gs *GSet) Contains(x interface{}) bool
- func (gs *GSet) Count() int
- func (gs *GSet) MarshalJSON() ([]byte, error)
- func (gs *GSet) Merge(other *GSet) *GSet
- func (gs *GSet) ToSlice() []interface{}
- func (gs *GSet) Update(x interface{})
- type LwwRegister
- type LwwSet
- type PNCounter
- type Twopset
- type USet
Constants ¶
This section is empty.
Variables ¶
var ( ErrorPreviouslyDeleted = errors.New("Element was previusly removed, cannot be added animore") ErrorElementDoesNotExist = errors.New("Element does not exist in the set") )
Functions ¶
This section is empty.
Types ¶
type GCounter ¶
type GCounter struct {
// contains filtered or unexported fields
}
GCounter implements an State-based increment-only Counter (Specification 6)
type GSet ¶
type GSet struct {
// contains filtered or unexported fields
}
GSet represents a State-based grow-only Set (G-Set, Specification 11)
func (*GSet) MarshalJSON ¶
MarshalJSON returns a JSON representation of the GSet according to github.com/aphyr/meangirls
type LwwRegister ¶
type LwwRegister struct {
// contains filtered or unexported fields
}
LwwRegister implement a State-based Last-Writer Wins Register (Specification 8) Note that the CRDT properties only hold if the clocks are synchtronized such that the timestamp gives a total order of events. That does typically not hold for distributed systems and can even be problematic on a single machine.
func NewLwwRegister ¶
func NewLwwRegister() *LwwRegister
func (*LwwRegister) Assign ¶
func (l *LwwRegister) Assign(x interface{})
func (*LwwRegister) Compare ¶
func (l *LwwRegister) Compare(other *LwwRegister) bool
Compare returns true, if l is older than other
func (*LwwRegister) Merge ¶
func (l *LwwRegister) Merge(other *LwwRegister) *LwwRegister
Merge merges l and other into a new LwwRegister
func (*LwwRegister) MergeFrom ¶
func (l *LwwRegister) MergeFrom(other *LwwRegister)
MergeFrom merges other into l
func (*LwwRegister) Value ¶
func (l *LwwRegister) Value() interface{}
Value returns the assigned value of the LwwRegister
type LwwSet ¶
type LwwSet struct {
// contains filtered or unexported fields
}
LwwSet implements a Last-Write-Wins element Set CRDT (3.3.3, Figure 12) Be aware that the CRDT properties only holds if the clocks are synchronized such that the timestamps provide a total ordering of events
type PNCounter ¶
type PNCounter struct {
// contains filtered or unexported fields
}
PNCounter impplementes a State-based PN-Counter (Specification 7)
func NewPNCounter ¶
func NewPNCounter() *PNCounter
type Twopset ¶
type Twopset struct {
// contains filtered or unexported fields
}
Twopset represents a State-based 2P-Set (Specification 12)
func NewTwopset ¶
func NewTwopset() *Twopset
type USet ¶
type USet struct {
// contains filtered or unexported fields
}
USet implement an Op-base 2P-Set with unique elements (Specification 13) Value HAVE to be unique element like UUIDs or Lamport Clocks TODO: Think about how to implement the predonditions: x is unique, add(x) has been delivered