ok/jj
1
0
Fork 0
forked from mirrors/jj

git_backend: cache head of saved extra metadata table

Just because we know the latest table head.
This commit is contained in:
Yuya Nishihara 2023-05-19 22:40:56 +09:00
parent a9422460cb
commit 5dba0502cb

View file

@ -133,12 +133,15 @@ impl GitBackend {
) -> BackendResult<()> {
let mut mut_table = table.start_mutation();
mut_table.add_entry(id.to_bytes(), extras);
self.extra_metadata_store
let table = self
.extra_metadata_store
.save_table(mut_table)
.map_err(|err| {
BackendError::Other(format!("Failed to write non-git metadata: {err}"))
})?;
*self.cached_extra_metadata.lock().unwrap() = None;
// Since the parent table was the head, saved table are likely to be new head.
// If it's not, cache will be reloaded when entry can't be found.
*self.cached_extra_metadata.lock().unwrap() = Some(table);
Ok(())
}
}