forked from sourcenetwork/defradb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP - Implement branchable collections
- Loading branch information
1 parent
7e086b1
commit 081a8a6
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright 2024 Democratized Data Foundation | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package crdt | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/sourcenetwork/defradb/internal/core" | ||
) | ||
|
||
type CollectionDelta struct { | ||
Priority uint64 | ||
// todo: This is temporary pending a global collection id (link to ticket) | ||
SchemaVersionID string | ||
} | ||
|
||
var _ core.Delta = (*CollectionDelta)(nil) | ||
var _ core.ReplicatedData = (*CollectionDelta)(nil) | ||
|
||
func (delta *CollectionDelta) IPLDSchemaBytes() []byte { //todo | ||
return []byte(` | ||
type CounterDelta struct { | ||
docID Bytes | ||
fieldName String | ||
priority Int | ||
nonce Int | ||
schemaVersionID String | ||
data Bytes | ||
}`) | ||
} | ||
|
||
func (d *CollectionDelta) GetPriority() uint64 { | ||
panic("todo") | ||
} | ||
|
||
func (d *CollectionDelta) SetPriority(uint64) { | ||
panic("todo") | ||
} | ||
|
||
func (d *CollectionDelta) Merge(ctx context.Context, other core.Delta) error { | ||
panic("todo") | ||
} |