Skip to content

Commit

Permalink
modern sync: add ctx and repo_blobstore to edenapi
Browse files Browse the repository at this point in the history
Summary: Used later

Reviewed By: RajivTS

Differential Revision: D67030117

fbshipit-source-id: 08c5c032ae045a91f5637c2e35d6d13234595503
  • Loading branch information
lmvasquezg authored and facebook-github-bot committed Dec 11, 2024
1 parent 0cefdca commit a269d4c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
13 changes: 12 additions & 1 deletion eden/mononoke/modern_sync/src/commands/sync_one.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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?;
Expand Down
13 changes: 12 additions & 1 deletion eden/mononoke/modern_sync/src/sender/edenapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -31,6 +33,8 @@ use crate::sender::ModernSyncSender;
pub struct EdenapiSender {
client: Client,
logger: Logger,
ctx: CoreContext,
repo_blobstore: RepoBlobstore,
}

impl EdenapiSender {
Expand All @@ -39,6 +43,8 @@ impl EdenapiSender {
reponame: String,
logger: Logger,
tls_args: TLSArgs,
ctx: CoreContext,
repo_blobstore: RepoBlobstore,
) -> Result<Self> {
let ci = ClientInfo::new_with_entry_point(ClientEntryPoint::ModernSync)?.to_json()?;
let http_config = HttpClientConfig {
Expand Down Expand Up @@ -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,
})
}
}

Expand Down
12 changes: 11 additions & 1 deletion eden/mononoke/modern_sync/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit a269d4c

Please sign in to comment.