feat: Replace the isDeleted flag by an int CLFlag (#55)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
parent
f85239c3a4
commit
b8ae05c76d
4 changed files with 406 additions and 49 deletions
|
|
@ -1,20 +1,24 @@
|
|||
### CRDT tombstone table.
|
||||
### CRDT visibility generation table.
|
||||
###
|
||||
### This table stores all tombstones for deleted data.
|
||||
### This table stores materialized monotone CLFlag metadata after a visibility
|
||||
### change event has been recorded.
|
||||
class: CrdtDataDeleted
|
||||
extends: BaseHlc
|
||||
table: crdt_data_tombstone
|
||||
database: all
|
||||
fields:
|
||||
### Row that was deleted.
|
||||
### Row whose visibility is tracked.
|
||||
row: CrdtDataRow?, relation(name=row_deleted, field=rowId, onDelete=Cascade)
|
||||
rowId: int
|
||||
|
||||
### The node that updated the field.
|
||||
node: CrdtNode?, relation
|
||||
|
||||
### When the row was deleted.
|
||||
isDeleted: bool
|
||||
### Monotone causal-length flag. Odd values are visible and even values are deleted.
|
||||
clFlag: int
|
||||
|
||||
### Why the row entered its current visibility generation.
|
||||
reason: CrdtDataDeletedReason
|
||||
|
||||
indexes:
|
||||
crdt_data_tombstone_row_idx:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
### Why a CRDT row entered its current visibility generation.
|
||||
enum: CrdtDataDeletedReason
|
||||
serialized: byIndex
|
||||
values:
|
||||
- userInsert
|
||||
- userDelete
|
||||
- userReinsert
|
||||
- restrictRestore
|
||||
- cascadeDelete
|
||||
- uniqueLoser
|
||||
|
|
@ -22,7 +22,10 @@ fields:
|
|||
### The node that inserted the row with the HLC timestamp.
|
||||
node: CrdtNode?, relation
|
||||
|
||||
### The tombstone for this row.
|
||||
### The visibility CLFlag for this row.
|
||||
###
|
||||
### Only present after the first visibility change event has been recorded.
|
||||
### If null, the row is visible and has never been deleted/hidden.
|
||||
deleted: CrdtDataDeleted?, relation(name=row_deleted, optional)
|
||||
|
||||
### The fields for this row.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
### A remote tombstone update to merge.
|
||||
### A remote visibility CLFlag update to merge.
|
||||
class: CrdtMergeDelete
|
||||
extends: CrdtMergeChange
|
||||
fields:
|
||||
### Whether the row is deleted or restored.
|
||||
isDeleted: bool
|
||||
### Monotone causal-length flag. Odd values are visible and even values are deleted.
|
||||
clFlag: int
|
||||
|
||||
### Why the row entered its current visibility generation.
|
||||
reason: CrdtDataDeletedReason
|
||||
|
|
|
|||
Loading…
Reference in a new issue