Skip to content

Commit

Permalink
WIP - Remove core.ReplicatedData from MerkleCRDT interface
Browse files Browse the repository at this point in the history
It is never actually used, and instead makes implementations of the MerkleCRDT have this weird self referencing hack via the clock, as well as doubling the implmentations of the already complicated core.ReplicatedData making it appear to be more complex than it actually is.
  • Loading branch information
AndrewSisley committed Oct 28, 2024
1 parent a7a1669 commit 95acd35
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 13 deletions.
4 changes: 0 additions & 4 deletions internal/merkle/crdt/composite.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ func (m *MerkleCompositeDAG) Clock() *clock.MerkleClock {
return m.clock
}

func (m *MerkleCompositeDAG) Merge(ctx context.Context, other core.Delta) error {
return m.reg.Merge(ctx, other)
}

// Delete sets the values of CompositeDAG for a delete.
func (m *MerkleCompositeDAG) Delete(
ctx context.Context,
Expand Down
4 changes: 0 additions & 4 deletions internal/merkle/crdt/counter.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ func (m *MerkleCounter) Clock() *clock.MerkleClock {
return m.clock
}

func (m *MerkleCounter) Merge(ctx context.Context, other core.Delta) error {
return m.reg.Merge(ctx, other)
}

// Save the value of the Counter to the DAG.
func (m *MerkleCounter) Save(ctx context.Context, data any) (cidlink.Link, []byte, error) {
value, ok := data.(*DocField)
Expand Down
4 changes: 0 additions & 4 deletions internal/merkle/crdt/lwwreg.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ func (m *MerkleLWWRegister) Clock() *clock.MerkleClock {
return m.clock
}

func (m *MerkleLWWRegister) Merge(ctx context.Context, other core.Delta) error {
return m.reg.Merge(ctx, other)
}

// Save the value of the register to the DAG.
func (m *MerkleLWWRegister) Save(ctx context.Context, data any) (cidlink.Link, []byte, error) {
value, ok := data.(*DocField)
Expand Down
1 change: 0 additions & 1 deletion internal/merkle/crdt/merklecrdt.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ type Stores interface {
// CRDT payload. It implements the ReplicatedData interface
// so it can be merged with any given semantics.
type MerkleCRDT interface {
core.ReplicatedData
Clock() *clock.MerkleClock
Save(ctx context.Context, data any) (cidlink.Link, []byte, error)
}
Expand Down

0 comments on commit 95acd35

Please sign in to comment.