Remove versioned offset ranges from transactions and undo operations

Now, instead of using these versioned offset ranges, we locate the
fragments associated with a transaction using the transaction's
edit ids. To make this possible, buffers now store a new map called
`insertion_slices`, which lets you look up the ranges of insertions
that were affected by a given edit.

Co-authored-by: Antonio Scandurra <antonio@zed.dev>
This commit is contained in:
Max Brunsfeld 2022-07-22 16:05:30 -07:00
parent 65fd943509
commit 7c3421e041
3 changed files with 137 additions and 178 deletions

View file

@ -39,11 +39,6 @@ pub fn serialize_operation(operation: &Operation) -> proto::Operation {
local_timestamp: undo.id.value,
lamport_timestamp: lamport_timestamp.value,
version: serialize_version(&undo.version),
transaction_ranges: undo
.transaction_ranges
.iter()
.map(serialize_range)
.collect(),
transaction_version: serialize_version(&undo.transaction_version),
counts: undo
.counts
@ -204,11 +199,6 @@ pub fn deserialize_operation(message: proto::Operation) -> Result<Operation> {
)
})
.collect(),
transaction_ranges: undo
.transaction_ranges
.into_iter()
.map(deserialize_range)
.collect(),
transaction_version: deserialize_version(undo.transaction_version),
},
}),
@ -461,7 +451,6 @@ pub fn serialize_transaction(transaction: &Transaction) -> proto::Transaction {
.collect(),
start: serialize_version(&transaction.start),
end: serialize_version(&transaction.end),
ranges: transaction.ranges.iter().map(serialize_range).collect(),
}
}
@ -479,11 +468,6 @@ pub fn deserialize_transaction(transaction: proto::Transaction) -> Result<Transa
.collect(),
start: deserialize_version(transaction.start.into()),
end: deserialize_version(transaction.end),
ranges: transaction
.ranges
.into_iter()
.map(deserialize_range)
.collect(),
})
}