mirror of
https://github.com/facebook/sapling.git
synced 2024-10-05 14:28:17 +03:00
walker: specify cache-mode default
Summary: Walker previously specified a default for the deprecated `cachelib-only-blobstore` argument. Switch to `cache-mode`, allowing us to specify local caching for all types, not just the blobstore. Differential Revision: D45089769 fbshipit-source-id: 978ac545590935be5a825669db9df58f0281c41a
This commit is contained in:
parent
0299d9bb5f
commit
32d13cc799
@ -9,6 +9,7 @@ license = "GPLv2+"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.65"
|
||||
arg_extensions = { version = "0.1.0", path = "../extensions" }
|
||||
cachelib = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
|
||||
clap = { version = "4.2.4", features = ["derive", "env", "string", "unicode", "wrap_help"] }
|
||||
environment = { version = "0.1.0", path = "../environment" }
|
||||
|
@ -5,6 +5,7 @@
|
||||
* GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
use arg_extensions::ArgDefaults;
|
||||
use clap::ArgAction;
|
||||
use clap::Args;
|
||||
use clap::ValueEnum;
|
||||
@ -21,6 +22,18 @@ pub enum CacheMode {
|
||||
Disabled,
|
||||
}
|
||||
|
||||
impl ArgDefaults for CacheMode {
|
||||
fn arg_defaults(&self) -> Vec<(&'static str, String)> {
|
||||
vec![(
|
||||
"cache_mode",
|
||||
self.to_possible_value()
|
||||
.expect("default value must exist")
|
||||
.get_name()
|
||||
.to_string(),
|
||||
)]
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Args, Debug)]
|
||||
pub struct CachelibArgs {
|
||||
/// Mode to initialize caching in.
|
||||
|
@ -19,6 +19,7 @@ use blobstore_factory::BlobstoreArgDefaults;
|
||||
use blobstore_factory::ReadOnlyStorage;
|
||||
use clap::ArgGroup;
|
||||
use clap::Parser;
|
||||
use cmdlib_caching::CacheMode;
|
||||
use cmdlib_caching::CachelibSettings;
|
||||
use cmdlib_scrubbing::ScrubAppExtension;
|
||||
use fbinit::FacebookInit;
|
||||
@ -63,7 +64,6 @@ fn main(fb: FacebookInit) -> Result<(), Error> {
|
||||
|
||||
let cachelib_defaults = CachelibSettings {
|
||||
cache_size: 2 * 1024 * 1024 * 1024,
|
||||
blobstore_cachelib_only: true,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
@ -85,6 +85,7 @@ fn main(fb: FacebookInit) -> Result<(), Error> {
|
||||
let app = MononokeAppBuilder::new(fb)
|
||||
.with_app_extension(scrub_extension)
|
||||
.with_default_cachelib_settings(cachelib_defaults)
|
||||
.with_arg_defaults(CacheMode::LocalOnly)
|
||||
.with_arg_defaults(blobstore_defaults)
|
||||
.with_arg_defaults(read_only_storage)
|
||||
.with_app_extension(Fb303AppExtension {})
|
||||
|
Loading…
Reference in New Issue
Block a user