diff --git a/lib/src/op_heads_store.rs b/lib/src/op_heads_store.rs index 62fa832e7..33a7d34c6 100644 --- a/lib/src/op_heads_store.rs +++ b/lib/src/op_heads_store.rs @@ -46,12 +46,6 @@ pub trait OpHeadsStore: Send + Sync + Debug { /// The old op heads must not contain the new one. fn update_op_heads(&self, old_ids: &[OperationId], new_id: &OperationId); - // TODO: migrate callers update_op_heads() - fn add_op_head(&self, id: &OperationId); - - // TODO: migrate callers update_op_heads() - fn remove_op_head(&self, id: &OperationId); - fn get_op_heads(&self) -> Vec; /// Optionally takes a lock on the op heads store. The purpose of the lock diff --git a/lib/src/simple_op_heads_store.rs b/lib/src/simple_op_heads_store.rs index 1437183c7..44e3928a3 100644 --- a/lib/src/simple_op_heads_store.rs +++ b/lib/src/simple_op_heads_store.rs @@ -50,6 +50,18 @@ impl SimpleOpHeadsStore { let op_heads_dir = dir.join("heads"); Self { dir: op_heads_dir } } + + fn add_op_head(&self, id: &OperationId) { + std::fs::write(self.dir.join(id.hex()), "").unwrap(); + } + + fn remove_op_head(&self, id: &OperationId) { + // It's fine if the old head was not found. It probably means + // that we're on a distributed file system where the locking + // doesn't work. We'll probably end up with two current + // heads. We'll detect that next time we load the view. + std::fs::remove_file(self.dir.join(id.hex())).ok(); + } } struct SimpleOpHeadsStoreLock { @@ -70,18 +82,6 @@ impl OpHeadsStore for SimpleOpHeadsStore { } } - fn add_op_head(&self, id: &OperationId) { - std::fs::write(self.dir.join(id.hex()), "").unwrap(); - } - - fn remove_op_head(&self, id: &OperationId) { - // It's fine if the old head was not found. It probably means - // that we're on a distributed file system where the locking - // doesn't work. We'll probably end up with two current - // heads. We'll detect that next time we load the view. - std::fs::remove_file(self.dir.join(id.hex())).ok(); - } - fn get_op_heads(&self) -> Vec { let mut op_heads = vec![]; for op_head_entry in std::fs::read_dir(&self.dir).unwrap() {