mirror of
https://github.com/facebook/sapling.git
synced 2024-12-26 14:34:34 +03:00
treemanifest: flush shared stores when flushing local stores
Summary: The Rust contentstore has no way to flush the shared stores, except when the object is destructed. In treemanifest, the lifetime of the shared store seems to be different from with files and we're not seeing them flushes appropriately during certain commands. Let's make the flush api also flush the shared stores. Reviewed By: quark-zju Differential Revision: D23662976 fbshipit-source-id: a542c3e45d5b489fcb5faf2726854cb49df16f4c
This commit is contained in:
parent
84f72950ad
commit
f68177a983
@ -165,6 +165,11 @@ class unioncontentstore(object):
|
||||
store.prefetch(keys)
|
||||
break
|
||||
|
||||
def flush(self):
|
||||
for store in self.stores:
|
||||
if util.safehasattr(store, "flush"):
|
||||
store.flush()
|
||||
|
||||
|
||||
class manifestrevlogstore(object):
|
||||
def __init__(self, repo):
|
||||
|
@ -48,3 +48,8 @@ class unionmetadatastore(object):
|
||||
|
||||
def removestore(self, store):
|
||||
self.stores.remove(store)
|
||||
|
||||
def flush(self):
|
||||
for store in self.stores:
|
||||
if util.safehasattr(store, "flush"):
|
||||
store.flush()
|
||||
|
@ -186,6 +186,7 @@ impl HgIdMutableDeltaStore for ContentStore {
|
||||
|
||||
/// Commit the data written to the local store.
|
||||
fn flush(&self) -> Result<Option<Vec<PathBuf>>> {
|
||||
self.shared_mutabledatastore.as_ref().flush()?;
|
||||
self.local_mutabledatastore
|
||||
.as_ref()
|
||||
.ok_or_else(|| format_err!("flushing a non-local ContentStore is not allowed"))?
|
||||
|
@ -125,6 +125,7 @@ impl HgIdMutableHistoryStore for MetadataStore {
|
||||
}
|
||||
|
||||
fn flush(&self) -> Result<Option<Vec<PathBuf>>> {
|
||||
self.shared_mutablehistorystore.as_ref().flush()?;
|
||||
self.local_mutablehistorystore
|
||||
.as_ref()
|
||||
.ok_or_else(|| format_err!("flushing a non-local MetadataStore is not allowed"))?
|
||||
|
Loading…
Reference in New Issue
Block a user