Skip to content

Commit

Permalink
modern sync: add upload_filenodes method
Browse files Browse the repository at this point in the history
Summary: Unused for now, this is prep for sending hg data

Reviewed By: markbt

Differential Revision: D67027144

fbshipit-source-id: ab046cff9d771ce720ffce5277a084940bc89410
  • Loading branch information
lmvasquezg authored and facebook-github-bot committed Dec 11, 2024
1 parent b2bbf4c commit 509b9f9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions eden/mononoke/modern_sync/src/sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use anyhow::Result;
use async_trait::async_trait;
use edenapi_types::HgFilenodeData;
use edenapi_types::UploadTreeEntry;
use mononoke_types::ContentId;
use mononoke_types::FileContents;
Expand All @@ -19,4 +20,7 @@ pub trait ModernSyncSender {

#[allow(unused)]
async fn upload_tree(&self, trees: Vec<UploadTreeEntry>) -> Result<()>;

#[allow(unused)]
async fn upload_filenodes(&self, filenodes: Vec<HgFilenodeData>) -> Result<()>;
}
11 changes: 11 additions & 0 deletions eden/mononoke/modern_sync/src/sender/dummy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use anyhow::Result;
use async_trait::async_trait;
use edenapi_types::HgFilenodeData;
use edenapi_types::UploadTreeEntry;
use mononoke_types::ContentId;
use mononoke_types::FileContents;
Expand Down Expand Up @@ -39,4 +40,14 @@ impl ModernSyncSender for DummySender {
}
Ok(())
}

async fn upload_filenodes(&self, filenodes: Vec<HgFilenodeData>) -> Result<()> {
for filenode in filenodes {
info!(
&self.logger,
"Uploading filenode with id {:?}", filenode.node_id
);
}
Ok(())
}
}
11 changes: 11 additions & 0 deletions eden/mononoke/modern_sync/src/sender/edenapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use edenapi::HttpClientBuilder;
use edenapi::HttpClientConfig;
use edenapi::SaplingRemoteApi;
use edenapi_types::AnyFileContentId;
use edenapi_types::HgFilenodeData;
use edenapi_types::UploadTreeEntry;
use futures::TryStreamExt;
use mononoke_app::args::TLSArgs;
Expand Down Expand Up @@ -110,4 +111,14 @@ impl ModernSyncSender for EdenapiSender {
);
Ok(())
}

async fn upload_filenodes(&self, filenodes: Vec<HgFilenodeData>) -> Result<()> {
let res = self.client.upload_filenodes_batch(filenodes).await?;
info!(
&self.logger,
"Upload filenodes response: {:?}",
res.entries.try_collect::<Vec<_>>().await?
);
Ok(())
}
}

0 comments on commit 509b9f9

Please sign in to comment.