memoryd: sync begins when Honcho is turned on, and conclusions are matched by peer
Co-Authored-By: ornith-1.5-35b-a3b <agent@wntrmute.dev>
This commit is contained in:
@@ -28,6 +28,14 @@ impl Home {
|
||||
Ledger::open(&self.path).unwrap()
|
||||
}
|
||||
|
||||
/// A new ledger that has begun (`began()`): what `memoryd` makes at its first start, and so
|
||||
/// what a test that reads its ledger back needs (M5c-1 task 15).
|
||||
pub fn begun(&self) -> Ledger {
|
||||
let mut ledger = self.open();
|
||||
ledger.append(began()).unwrap();
|
||||
ledger
|
||||
}
|
||||
|
||||
/// The file's bytes as text; "" when there is no file.
|
||||
pub fn text(&self) -> String {
|
||||
std::fs::read_to_string(&self.path).unwrap_or_default()
|
||||
@@ -85,13 +93,25 @@ pub fn conclude(workspace: Workspace, text: &str) -> Action {
|
||||
}
|
||||
}
|
||||
|
||||
/// The deletion of the owner's (`kyle`'s) conclusion `text`, as `conclude` makes it.
|
||||
pub fn unconclude(workspace: Workspace, text: &str) -> Action {
|
||||
Action::Unconclude {
|
||||
workspace,
|
||||
peer: "kyle".to_string(),
|
||||
text: text.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
/// When sync began, `TIME`.
|
||||
pub fn began() -> Record {
|
||||
Record::Began { time: time() }
|
||||
}
|
||||
|
||||
/// `began()`'s line.
|
||||
pub fn began_line() -> String {
|
||||
line(&began())
|
||||
}
|
||||
|
||||
pub fn decided(item: &Item, action: Action) -> Record {
|
||||
Record::Decided {
|
||||
time: time(),
|
||||
|
||||
Reference in New Issue
Block a user