mononoke: rename get_all_filenodes to get_all_filenodes_maybe_stale

Summary:
New name better reflects what this function does - it might return cached
version of filenodes that might be out of date.

Reviewed By: aslpavel

Differential Revision: D15896734

fbshipit-source-id: caf4f1d3a9a29889327c3373ac886687ec916903
This commit is contained in:
Stanislau Hlebik 2019-06-20 01:47:28 -07:00 committed by Facebook Github Bot
parent b7fa26fd69
commit 30227f6c72
8 changed files with 14 additions and 22 deletions

View File

@ -212,7 +212,7 @@ impl<F: Filenodes> Filenodes for DelayedFilenodes<F> {
.boxify()
}
fn get_all_filenodes(
fn get_all_filenodes_maybe_stale(
&self,
ctx: CoreContext,
path: &RepoPath,
@ -220,7 +220,7 @@ impl<F: Filenodes> Filenodes for DelayedFilenodes<F> {
) -> BoxFuture<Vec<FilenodeInfo>, Error> {
delay(
self.get_dist,
self.inner.get_all_filenodes(ctx, path, repo_id),
self.inner.get_all_filenodes_maybe_stale(ctx, path, repo_id),
)
.boxify()
}

View File

@ -845,13 +845,14 @@ impl BlobRepo {
})
}
pub fn get_all_filenodes(
pub fn get_all_filenodes_maybe_stale(
&self,
ctx: CoreContext,
path: RepoPath,
) -> BoxFuture<Vec<FilenodeInfo>, Error> {
STATS::get_all_filenodes.add_value(1);
self.filenodes.get_all_filenodes(ctx, &path, self.repoid)
self.filenodes
.get_all_filenodes_maybe_stale(ctx, &path, self.repoid)
}
pub fn get_bonsai_from_hg(

View File

@ -330,7 +330,7 @@ impl Filenodes for SqlFilenodes {
.boxify()
}
fn get_all_filenodes(
fn get_all_filenodes_maybe_stale(
&self,
_ctx: CoreContext,
path: &RepoPath,

View File

@ -170,7 +170,7 @@ fn assert_all_filenodes(
expected: &Vec<FilenodeInfo>,
) {
let res = filenodes
.get_all_filenodes(ctx, path, repo_id)
.get_all_filenodes_maybe_stale(ctx, path, repo_id)
.wait()
.expect("error while fetching filenode");
assert_eq!(&res, expected);
@ -513,7 +513,7 @@ macro_rules! filenodes_tests {
}
#[test]
fn get_all_filenodes() {
fn get_all_filenodes_maybe_stale() {
async_unit::tokio_unit_test(|| -> Result<_, !> {
let ctx = CoreContext::test_mock();
let filenodes = &$create_db();

View File

@ -140,7 +140,7 @@ impl Filenodes for CachingFilenodes {
})
}
fn get_all_filenodes(
fn get_all_filenodes_maybe_stale(
&self,
ctx: CoreContext,
path: &RepoPath,
@ -168,7 +168,7 @@ impl Filenodes for CachingFilenodes {
}
filenodes
.get_all_filenodes(ctx, &path, repo_id)
.get_all_filenodes_maybe_stale(ctx, &path, repo_id)
.inspect(move |all_filenodes| {
schedule_fill_all_filenodes_memcache(
all_filenodes,

View File

@ -127,7 +127,7 @@ pub trait Filenodes: Send + Sync {
repo_id: RepositoryId,
) -> BoxFuture<Option<FilenodeInfo>, Error>;
fn get_all_filenodes(
fn get_all_filenodes_maybe_stale(
&self,
ctx: CoreContext,
path: &RepoPath,

View File

@ -257,7 +257,7 @@ fn prefetch_history(
repo: BlobRepo,
path: MPath,
) -> impl Future<Item = HashMap<HgFileNodeId, FilenodeInfo>, Error = Error> {
repo.get_all_filenodes(ctx, RepoPath::FilePath(path))
repo.get_all_filenodes_maybe_stale(ctx, RepoPath::FilePath(path))
.map(|filenodes| {
filenodes
.into_iter()

View File

@ -184,17 +184,8 @@ Merge when one filenode is ancestor of another
$ hg merge -q $SECONDPARENT
$ hg ci -m 'ancestors'
$ hgmn push -r . --to master_bookmark -q
$ hg log -r tip
changeset: 18:83581fc6568a
tag: tip
bookmark: default/master_bookmark
hoistedname: master_bookmark
parent: 17:e8569a9ce348
parent: 16:b34dc1eaf12c
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: ancestors
$ hg log -r tip -T '{node}\n'
83581fc6568afb36a68d6f3cbfe7c044bdd96457
$ hgmn st --change tip -C
M ancestorscase
A somefile