mononoke: Migrate populate_healer for new storage config data model

Summary: Update populate_healer to act directly on a blobstore config rather than indirectly via a repo config.

Reviewed By: StanislavGlebik

Differential Revision: D15065424

fbshipit-source-id: 638778a61283dc9ed991c49936a21d02b8d2e3f3
This commit is contained in:
Alex Hornby 2019-08-05 03:46:26 -07:00 committed by Facebook Github Bot
parent 59b47cf4fa
commit b43dc6e5a7

View File

@ -119,6 +119,14 @@ fn parse_args() -> Result<Config, Error> {
.build("populate healer queue")
.version("0.0.0")
.about("Populate blobstore queue from existing manifold bucket")
.arg(
Arg::with_name("storage-id")
.long("storage-id")
.short("S")
.takes_value(true)
.value_name("STORAGEID")
.help("Storage identifier"),
)
.arg(
Arg::with_name("source-blobstore-id")
.long("source-blobstore-id")
@ -165,16 +173,13 @@ fn parse_args() -> Result<Config, Error> {
let matches = app.get_matches();
let repo_id = args::get_repo_id(&matches)?;
let repo_config = args::read_configs(&matches)?
.repos
.into_iter()
.filter(|(_, config)| RepositoryId::new(config.repoid) == repo_id)
.map(|(_, config)| config)
.next()
.ok_or(format_err!(
"failed to find config with repo id: {:?}",
repo_id
))?;
let storage_id = matches
.value_of("storage-id")
.ok_or(err_msg("`storage-id` argument required"))?;
let storage_config = args::read_storage_configs(&matches)?
.remove(storage_id)
.ok_or(err_msg("Unknown `storage-id`"))?;
let src_blobstore_id = matches
.value_of("source-blobstore-id")
@ -192,7 +197,7 @@ fn parse_args() -> Result<Config, Error> {
));
}
let (blobstores, db_address) = match &repo_config.storage_config {
let (blobstores, db_address) = match storage_config {
StorageConfig {
dbconfig: MetadataDBConfig::Mysql { db_address, .. },
blobstore: BlobConfig::Multiplexed { blobstores, .. },