WIP - Serialize buffer in terms of its state, not its base text + ops
The main reason for this is that we need to include information about a buffer's UndoMap into its protobuf representation. But it's a bit complex to correctly incorporate this information into the current protobuf representation. If we want to continue reusing `Buffer::apply_remote_edit` for incorporating the historical operations, we need to either make that method capable of incorporating already-undone edits, or serialize the UndoMap into undo *operations*, so that we can apply these undo operations after the fact when deserializing. But this is not trivial, because an UndoOperation requires information about the full offset ranges that were undone.
This commit is contained in:
parent
d7ecbdcc1d
commit
984e366c32
6 changed files with 222 additions and 44 deletions
|
@ -263,9 +263,23 @@ message Entry {
|
|||
message Buffer {
|
||||
uint64 id = 1;
|
||||
string content = 2;
|
||||
repeated Operation.Edit history = 3;
|
||||
repeated SelectionSet selections = 4;
|
||||
repeated DiagnosticSet diagnostic_sets = 5;
|
||||
string deleted_content = 3;
|
||||
repeated BufferFragment fragments = 4;
|
||||
repeated UndoMapEntry undo_map = 5;
|
||||
repeated VectorClockEntry version = 6;
|
||||
repeated SelectionSet selections = 7;
|
||||
repeated DiagnosticSet diagnostic_sets = 8;
|
||||
}
|
||||
|
||||
message BufferFragment {
|
||||
uint32 replica_id = 1;
|
||||
uint32 local_timestamp = 2;
|
||||
uint32 lamport_timestamp = 3;
|
||||
uint32 insertion_offset = 4;
|
||||
uint32 len = 5;
|
||||
bool visible = 6;
|
||||
repeated VectorClockEntry deletions = 7;
|
||||
repeated VectorClockEntry max_undos = 8;
|
||||
}
|
||||
|
||||
message SelectionSet {
|
||||
|
@ -350,12 +364,6 @@ message Operation {
|
|||
repeated UndoCount counts = 6;
|
||||
}
|
||||
|
||||
message UndoCount {
|
||||
uint32 replica_id = 1;
|
||||
uint32 local_timestamp = 2;
|
||||
uint32 count = 3;
|
||||
}
|
||||
|
||||
message UpdateSelections {
|
||||
uint32 replica_id = 1;
|
||||
uint32 lamport_timestamp = 3;
|
||||
|
@ -368,6 +376,18 @@ message Operation {
|
|||
}
|
||||
}
|
||||
|
||||
message UndoMapEntry {
|
||||
uint32 replica_id = 1;
|
||||
uint32 local_timestamp = 2;
|
||||
repeated UndoCount counts = 3;
|
||||
}
|
||||
|
||||
message UndoCount {
|
||||
uint32 replica_id = 1;
|
||||
uint32 local_timestamp = 2;
|
||||
uint32 count = 3;
|
||||
}
|
||||
|
||||
message VectorClockEntry {
|
||||
uint32 replica_id = 1;
|
||||
uint32 timestamp = 2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue