scmstore: add method for getting local-only TreeStore

Summary:
Add a `local` method to `TreeStore` like the one on `FileStore` which returns a `TreeStore` with only the local subset of backends.

Required for `BackingStore` implementation.

Reviewed By: kulshrax

Differential Revision: D30253980

fbshipit-source-id: 142f2d88454826ff9cb9c34f30b7d21bf62b297c
This commit is contained in:
Meyer Jacobs 2021-08-12 19:33:46 -07:00 committed by Facebook GitHub Bot
parent 47fd500315
commit c5b59696e9

View File

@ -245,6 +245,20 @@ impl TreeStore {
}))
}
/// Returns a TreeStore with only the local subset of backends
pub fn local(&self) -> TreeStore {
TreeStore {
indexedlog_local: self.indexedlog_local.clone(),
indexedlog_cache: self.indexedlog_cache.clone(),
cache_to_local_cache: false,
memcache: None,
cache_to_memcache: false,
edenapi: None,
contentstore: None,
creation_time: Instant::now(),
}
}
pub fn empty() -> Self {
TreeStore {
indexedlog_local: None,