cob: provide stable ordering of concurrent values
The underlying Dag for a COB will use the Ord implementation of
whatever is provided as the key. This means that the lexicographical
ordering of the Oid SHA will be used, which in turn means that if
the SHAs change in our tests, then the ordering will be broken for
concurrent updates.
To prevent this from happening, a new key is used EntryKey, which is
the combination of an Oid and a Timestamp – the commit
timestamp. The key is used in place of EntryId as the Dag key.
This introduction meant that in some places it was necessary to have a
way of getting the timestamp of an EntryId. The TimestampOf trait
is used in these cases, which means that some infallible functions
became fallible.
2 files changed
+130
-17
de1958fa
→
b4f2614d
modified radicle-cob/src/change_graph.rs
@@ -1,7 +1,7 @@
|
|
|
|
| - | |
|
|
| + | |
|
|
|
|
|
@@ -113,20 +113,24 @@ impl ChangeGraph {
|
|
|
|
|
|
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
@@ -144,6 +148,10 @@ impl ChangeGraph {
|
|
|
|
|
|
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
modified radicle-dag/src/lib.rs
@@ -201,7 +201,7 @@ impl<K: Ord + Copy, V> Dag<K, V> {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -209,11 +209,30 @@ impl<K: Ord + Copy, V> Dag<K, V> {
|
|
|
|
|
|
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -369,6 +388,32 @@ impl<K: Ord + Copy, V> Dag<K, V> {
|
|
|
|
|
|
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
@@ -915,4 +960,64 @@ mod tests {
|
|
|
|
|
|
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|