Add StoredValues.REPO_MANAGER

First customer will be the find-owners plugin to check owner approval
at change submit time, when it might need to include/read OWNERS files
in different repositories. OwnersDb is cached to avoid repeated access
to the same OWNERS files.

Change-Id: If94c29d961807daf961bfa6f2e6ffed4e9731d6c
This commit is contained in:
Chih-Hung Hsieh 2018-10-24 18:25:00 -07:00 committed by Chih-hung Hsieh
parent 9dd2fa2aaf
commit 0a2f13a555

View File

@ -110,6 +110,18 @@ public final class StoredValues {
} }
}; };
// Accessing GitRepositoryManager could be slow.
// It should be minimized or cached to reduce pause time
// when evaluating Prolog submit rules.
public static final StoredValue<GitRepositoryManager> REPO_MANAGER =
new StoredValue<GitRepositoryManager>() {
@Override
public GitRepositoryManager createValue(Prolog engine) {
PrologEnvironment env = (PrologEnvironment) engine.control;
return env.getArgs().getGitRepositoryManager();
}
};
public static final StoredValue<Repository> REPOSITORY = public static final StoredValue<Repository> REPOSITORY =
new StoredValue<Repository>() { new StoredValue<Repository>() {
@Override @Override