Package com.google.gerrit.server.rules
Class RulesCache
- java.lang.Object
-
- com.google.gerrit.server.rules.RulesCache
-
public class RulesCache extends Object
Manages a cache of compiled Prolog rules.Rules are loaded from the
site_path/cache/rules/rules-SHA1.jar
, whereSHA1
is the SHA1 of the Prologrules.pl
in a project'sRefNames.REFS_CONFIG
branch.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RulesCache.Module
-
Constructor Summary
Constructors Modifier Constructor Description protected
RulesCache(org.eclipse.jgit.lib.Config config, SitePaths site, GitRepositoryManager gm, PluginSetContext<PredicateProvider> predicateProviders, com.google.common.cache.Cache<org.eclipse.jgit.lib.ObjectId,com.googlecode.prolog_cafe.lang.PrologMachineCopy> machineCache)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isProjectRulesEnabled()
com.googlecode.prolog_cafe.lang.PrologMachineCopy
loadMachine(Project.NameKey project, org.eclipse.jgit.lib.ObjectId rulesId)
Locate a cached Prolog machine state, or create one if not available.com.googlecode.prolog_cafe.lang.PrologMachineCopy
loadMachine(String name, Reader in)
-
-
-
Constructor Detail
-
RulesCache
@Inject protected RulesCache(org.eclipse.jgit.lib.Config config, SitePaths site, GitRepositoryManager gm, PluginSetContext<PredicateProvider> predicateProviders, com.google.common.cache.Cache<org.eclipse.jgit.lib.ObjectId,com.googlecode.prolog_cafe.lang.PrologMachineCopy> machineCache)
-
-
Method Detail
-
isProjectRulesEnabled
public boolean isProjectRulesEnabled()
-
loadMachine
public com.googlecode.prolog_cafe.lang.PrologMachineCopy loadMachine(@Nullable Project.NameKey project, @Nullable org.eclipse.jgit.lib.ObjectId rulesId) throws com.googlecode.prolog_cafe.exceptions.CompileException
Locate a cached Prolog machine state, or create one if not available.- Returns:
- a Prolog machine, after loading the specified rules.
- Throws:
com.googlecode.prolog_cafe.exceptions.CompileException
- the machine cannot be created.
-
-