forked from mirrors/jj
op heads: remove now-unused methods for adding/removing op heads
This commit is contained in:
parent
65a6aa61db
commit
d06764eb7c
2 changed files with 12 additions and 18 deletions
|
@ -46,12 +46,6 @@ pub trait OpHeadsStore: Send + Sync + Debug {
|
||||||
/// The old op heads must not contain the new one.
|
/// The old op heads must not contain the new one.
|
||||||
fn update_op_heads(&self, old_ids: &[OperationId], new_id: &OperationId);
|
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<OperationId>;
|
fn get_op_heads(&self) -> Vec<OperationId>;
|
||||||
|
|
||||||
/// Optionally takes a lock on the op heads store. The purpose of the lock
|
/// Optionally takes a lock on the op heads store. The purpose of the lock
|
||||||
|
|
|
@ -50,6 +50,18 @@ impl SimpleOpHeadsStore {
|
||||||
let op_heads_dir = dir.join("heads");
|
let op_heads_dir = dir.join("heads");
|
||||||
Self { dir: op_heads_dir }
|
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 {
|
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<OperationId> {
|
fn get_op_heads(&self) -> Vec<OperationId> {
|
||||||
let mut op_heads = vec![];
|
let mut op_heads = vec![];
|
||||||
for op_head_entry in std::fs::read_dir(&self.dir).unwrap() {
|
for op_head_entry in std::fs::read_dir(&self.dir).unwrap() {
|
||||||
|
|
Loading…
Reference in a new issue