From a269d4cc1084e9eeec0116ea84d63649c20e48f1 Mon Sep 17 00:00:00 2001 From: Luisa Vasquez Gomez Date: Wed, 11 Dec 2024 09:50:08 -0800 Subject: [PATCH] modern sync: add ctx and repo_blobstore to edenapi Summary: Used later Reviewed By: RajivTS Differential Revision: D67030117 fbshipit-source-id: 08c5c032ae045a91f5637c2e35d6d13234595503 --- eden/mononoke/modern_sync/src/commands/sync_one.rs | 13 ++++++++++++- eden/mononoke/modern_sync/src/sender/edenapi.rs | 13 ++++++++++++- eden/mononoke/modern_sync/src/sync.rs | 12 +++++++++++- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/eden/mononoke/modern_sync/src/commands/sync_one.rs b/eden/mononoke/modern_sync/src/commands/sync_one.rs index 939a15bd34a30..82a558b92e1af 100644 --- a/eden/mononoke/modern_sync/src/commands/sync_one.rs +++ b/eden/mononoke/modern_sync/src/commands/sync_one.rs @@ -16,6 +16,7 @@ use context::SessionContainer; use metadata::Metadata; use mononoke_app::MononokeApp; use mononoke_types::ChangesetId; +use repo_blobstore::RepoBlobstoreRef; use repo_identity::RepoIdentityRef; use url::Url; @@ -83,7 +84,17 @@ pub async fn run(app: MononokeApp, args: CommandArgs) -> Result<()> { let dest_repo = app_args.dest_repo_name.clone().unwrap_or(repo_name.clone()); - Arc::new(EdenapiSender::new(Url::parse(&url)?, dest_repo, logger.clone(), tls_args).await?) + Arc::new( + EdenapiSender::new( + Url::parse(&url)?, + dest_repo, + logger.clone(), + tls_args, + ctx.clone(), + repo.repo_blobstore().clone(), + ) + .await?, + ) }; crate::sync::process_one_changeset(&args.cs_id, &ctx, repo, &logger, sender, false).await?; diff --git a/eden/mononoke/modern_sync/src/sender/edenapi.rs b/eden/mononoke/modern_sync/src/sender/edenapi.rs index 33da203a76d6c..51958b472d3b5 100644 --- a/eden/mononoke/modern_sync/src/sender/edenapi.rs +++ b/eden/mononoke/modern_sync/src/sender/edenapi.rs @@ -11,6 +11,7 @@ use anyhow::Result; use async_trait::async_trait; use clientinfo::ClientEntryPoint; use clientinfo::ClientInfo; +use context::CoreContext; use edenapi::Client; use edenapi::HttpClientBuilder; use edenapi::HttpClientConfig; @@ -21,6 +22,7 @@ use edenapi_types::UploadTreeEntry; use futures::TryStreamExt; use mononoke_app::args::TLSArgs; use mononoke_types::FileContents; +use repo_blobstore::RepoBlobstore; use slog::info; use slog::Logger; use url::Url; @@ -31,6 +33,8 @@ use crate::sender::ModernSyncSender; pub struct EdenapiSender { client: Client, logger: Logger, + ctx: CoreContext, + repo_blobstore: RepoBlobstore, } impl EdenapiSender { @@ -39,6 +43,8 @@ impl EdenapiSender { reponame: String, logger: Logger, tls_args: TLSArgs, + ctx: CoreContext, + repo_blobstore: RepoBlobstore, ) -> Result { let ci = ClientInfo::new_with_entry_point(ClientEntryPoint::ModernSync)?.to_json()?; let http_config = HttpClientConfig { @@ -66,7 +72,12 @@ impl EdenapiSender { let res = client.health().await; info!(logger, "Health check outcome: {:?}", res); - Ok(Self { client, logger }) + Ok(Self { + client, + logger, + ctx, + repo_blobstore, + }) } } diff --git a/eden/mononoke/modern_sync/src/sync.rs b/eden/mononoke/modern_sync/src/sync.rs index e0c761e9ca9fa..9ad3cac77b6e0 100644 --- a/eden/mononoke/modern_sync/src/sync.rs +++ b/eden/mononoke/modern_sync/src/sync.rs @@ -140,7 +140,17 @@ pub async fn sync( let dest_repo = app_args.dest_repo_name.clone().unwrap_or(repo_name.clone()); - Arc::new(EdenapiSender::new(Url::parse(&url)?, dest_repo, logger.clone(), tls_args).await?) + Arc::new( + EdenapiSender::new( + Url::parse(&url)?, + dest_repo, + logger.clone(), + tls_args, + ctx.clone(), + repo.repo_blobstore().clone(), + ) + .await?, + ) }; let mut scuba_sample = ctx.scuba().clone();