From 34fbac34e19aa34e5ad187e946e4a3a7a634de42 Mon Sep 17 00:00:00 2001 From: Thomas Orozco Date: Thu, 26 Nov 2020 08:20:07 -0800 Subject: [PATCH] mononoke/mercurial_types: remove unused ContentBlobInfo Summary: This contains a path, which it turns out is actually never used throughout the codebase. Remove it. Reviewed By: markbt Differential Revision: D25122292 fbshipit-source-id: eab528bfb1e3893bca4d92d62c30499cf9eead6c --- eden/mononoke/mercurial/types/src/blobs/mod.rs | 3 +-- .../mercurial/types/src/blobs/upload.rs | 12 ++---------- .../unbundle/src/changegroup/filelog.rs | 10 +++++----- .../repo_client/unbundle/src/resolver.rs | 4 ++-- .../unbundle/src/upload_changesets.rs | 18 +++++++++--------- 5 files changed, 19 insertions(+), 28 deletions(-) diff --git a/eden/mononoke/mercurial/types/src/blobs/mod.rs b/eden/mononoke/mercurial/types/src/blobs/mod.rs index b89ab2e4f6c31..0045eb7f56eb4 100644 --- a/eden/mononoke/mercurial/types/src/blobs/mod.rs +++ b/eden/mononoke/mercurial/types/src/blobs/mod.rs @@ -32,6 +32,5 @@ pub mod filenode_lookup; mod upload; pub use upload::{ - ContentBlobInfo, ContentBlobMeta, UploadHgFileContents, UploadHgFileEntry, UploadHgNodeHash, - UploadHgTreeEntry, + ContentBlobMeta, UploadHgFileContents, UploadHgFileEntry, UploadHgNodeHash, UploadHgTreeEntry, }; diff --git a/eden/mononoke/mercurial/types/src/blobs/upload.rs b/eden/mononoke/mercurial/types/src/blobs/upload.rs index 81b63440b1480..fef181dbde978 100644 --- a/eden/mononoke/mercurial/types/src/blobs/upload.rs +++ b/eden/mononoke/mercurial/types/src/blobs/upload.rs @@ -40,14 +40,6 @@ define_stats! { upload_blob: timeseries(Rate, Sum), } -/// Information about a content blob associated with a push that is available in -/// the blobstore. (This blob wasn't necessarily uploaded in this push.) -#[derive(Clone, Debug, Eq, PartialEq)] -pub struct ContentBlobInfo { - pub path: MPath, - pub meta: ContentBlobMeta, -} - /// Metadata associated with a content blob being uploaded as part of changeset creation. #[derive(Clone, Debug, Eq, PartialEq)] pub struct ContentBlobMeta { @@ -405,7 +397,7 @@ impl UploadHgFileEntry { self, ctx: CoreContext, blobstore: Arc, - ) -> Result<(ContentBlobInfo, BoxFuture<(HgBlobEntry, RepoPath), Error>)> { + ) -> Result<(ContentBlobMeta, BoxFuture<(HgBlobEntry, RepoPath), Error>)> { STATS::upload_hg_file_entry.add_value(1); let UploadHgFileEntry { upload_node_id, @@ -492,7 +484,7 @@ impl UploadHgFileEntry { let fut = envelope_upload .join(content_upload) .map(move |(envelope_res, ())| envelope_res); - Ok((ContentBlobInfo { path, meta: cbmeta }, fut.boxify())) + Ok((cbmeta, fut.boxify())) } fn log_stats( diff --git a/eden/mononoke/repo_client/unbundle/src/changegroup/filelog.rs b/eden/mononoke/repo_client/unbundle/src/changegroup/filelog.rs index 7e29002ddb3c2..c71ca6be24ded 100644 --- a/eden/mononoke/repo_client/unbundle/src/changegroup/filelog.rs +++ b/eden/mononoke/repo_client/unbundle/src/changegroup/filelog.rs @@ -28,8 +28,8 @@ use filestore::FetchKey; use mercurial_bundles::changegroup::CgDeltaChunk; use mercurial_types::{ blobs::{ - ContentBlobInfo, ContentBlobMeta, File, HgBlobEntry, UploadHgFileContents, - UploadHgFileEntry, UploadHgNodeHash, + ContentBlobMeta, File, HgBlobEntry, UploadHgFileContents, UploadHgFileEntry, + UploadHgNodeHash, }, delta, Delta, FileType, HgFileNodeId, HgNodeHash, HgNodeKey, MPath, RepoPath, RevFlags, NULL_HASH, @@ -68,7 +68,7 @@ impl UploadableHgBlob for Filelog { // SharedError) doesn't implement Fail, and only implements Error if the wrapped type // implements Error. type Value = ( - ContentBlobInfo, + ContentBlobMeta, Shared>>, ); @@ -97,8 +97,8 @@ impl UploadableHgBlob for Filelog { path, }; - let (cbinfo, fut) = upload.upload(ctx, repo.get_blobstore().boxed())?; - Ok((node_key, (cbinfo, fut.map_err(Compat).boxify().shared()))) + let (cbmeta, fut) = upload.upload(ctx, repo.get_blobstore().boxed())?; + Ok((node_key, (cbmeta, fut.map_err(Compat).boxify().shared()))) } } diff --git a/eden/mononoke/repo_client/unbundle/src/resolver.rs b/eden/mononoke/repo_client/unbundle/src/resolver.rs index 4ea8e46fd32fe..02e9c087f2445 100644 --- a/eden/mononoke/repo_client/unbundle/src/resolver.rs +++ b/eden/mononoke/repo_client/unbundle/src/resolver.rs @@ -42,7 +42,7 @@ use mercurial_bundles::{ use mercurial_mutation::HgMutationEntry; use mercurial_revlog::changeset::RevlogChangeset; use mercurial_types::{ - blobs::{ContentBlobInfo, HgBlobEntry}, + blobs::{ContentBlobMeta, HgBlobEntry}, HgChangesetId, HgNodeKey, RepoPath, }; use metaconfig_types::{PushrebaseFlags, RepoReadOnly}; @@ -77,7 +77,7 @@ mod UNBUNDLE_STATS { pub type Changesets = Vec<(HgChangesetId, RevlogChangeset)>; type Filelogs = HashMap>>>; -type ContentBlobs = HashMap; +type ContentBlobs = HashMap; type Manifests = HashMap::Value>; pub type UploadedBonsais = HashSet; pub type UploadedHgChangesetIds = HashSet; diff --git a/eden/mononoke/repo_client/unbundle/src/upload_changesets.rs b/eden/mononoke/repo_client/unbundle/src/upload_changesets.rs index 13f4b275310eb..c1a721219e700 100644 --- a/eden/mononoke/repo_client/unbundle/src/upload_changesets.rs +++ b/eden/mononoke/repo_client/unbundle/src/upload_changesets.rs @@ -25,7 +25,7 @@ use mercurial_revlog::{ manifest::{Details, ManifestContent}, }; use mercurial_types::{ - blobs::{ChangesetMetadata, ContentBlobInfo, HgBlobEntry}, + blobs::{ChangesetMetadata, ContentBlobMeta, HgBlobEntry}, HgChangesetId, HgManifestId, HgNodeHash, HgNodeKey, MPath, RepoPath, NULL_HASH, }; use scuba_ext::ScubaSampleBuilder; @@ -34,7 +34,7 @@ use std::ops::AddAssign; use wirepack::TreemanifestEntry; type Filelogs = HashMap>>>; -type ContentBlobs = HashMap; +type ContentBlobs = HashMap; type Manifests = HashMap::Value>; type UploadedChangesets = HashMap; @@ -52,7 +52,7 @@ pub struct NewBlobs { // This is returned as a Vec rather than a Stream so that the path and metadata are // available before the content blob is uploaded. This will allow creating and uploading // changeset blobs without being blocked on content blob uploading being complete. - content_blobs: Vec, + content_blobs: Vec, } struct WalkHelperCounters { @@ -148,7 +148,7 @@ impl NewBlobs { manifests: &Manifests, filelogs: &Filelogs, content_blobs: &ContentBlobs, - ) -> Result<(Vec, Vec, WalkHelperCounters)> { + ) -> Result<(Vec, Vec, WalkHelperCounters)> { if path_taken.len() > 4096 { bail!( "Exceeded max manifest path during walking with path: {:?}", @@ -157,7 +157,7 @@ impl NewBlobs { } let mut entries: Vec = Vec::new(); - let mut cbinfos: Vec = Vec::new(); + let mut cbmetas: Vec = Vec::new(); let mut counters = WalkHelperCounters { manifests_count: 0, filelogs_count: 0, @@ -197,7 +197,7 @@ impl NewBlobs { .from_err() .boxify(), ); - let (mut walked_entries, mut walked_cbinfos, sub_counters) = Self::walk_helper( + let (mut walked_entries, mut walked_cbmetas, sub_counters) = Self::walk_helper( &key.path, manifest_content, get_manifest_parent_content(manifests, key.path.clone(), p1.clone()), @@ -207,7 +207,7 @@ impl NewBlobs { content_blobs, )?; entries.append(&mut walked_entries); - cbinfos.append(&mut walked_cbinfos); + cbmetas.append(&mut walked_cbmetas); counters += sub_counters; } } else { @@ -226,14 +226,14 @@ impl NewBlobs { .boxify(), ); match content_blobs.get(&key) { - Some(cbinfo) => cbinfos.push(cbinfo.clone()), + Some(cbmeta) => cbmetas.push(cbmeta.clone()), None => bail!("internal error: content blob future missing for filenode"), } } } } - Ok((entries, cbinfos, counters)) + Ok((entries, cbmetas, counters)) } }