Class PeepholePermalink
- java.lang.Object
-
- hudson.model.PermalinkProjectAction.Permalink
-
- jenkins.model.PeepholePermalink
-
public abstract class PeepholePermalink extends PermalinkProjectAction.Permalink implements Predicate<Run<?,?>>
Convenient base implementation forPermalinkProjectAction.Permalink
s that satisfy certain properties.For a permalink to be able to use this, it has to satisfy the following:
Given a job J, permalink is a function F that computes a build B. A peephole permalink is a subset of this function that can be deduced to the "peep-hole" function G(B)→bool:
F(J) = { newest B | G(B)==true }
Intuitively speaking, a peep-hole permalink resolves to the latest build that satisfies a certain characteristics that can be determined solely by looking at the build and nothing else (most commonly its build result.)
This base class provides a file-based caching mechanism that avoids walking the long build history.
The implementation transparently tolerates G(B) that goes from true to false over time (it simply scans the history till find the new matching build.) To tolerate G(B) that goes from false to true, you need to be able to intercept whenever G(B) changes from false to true, then call
resolve(Job)
to check the current permalink target is up to date, then callupdateCache(Job, Run)
if it needs updating.- Since:
- 1.507
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PeepholePermalink.RunListenerImpl
-
Field Summary
-
Fields inherited from class hudson.model.PermalinkProjectAction.Permalink
BUILTIN, LAST_BUILD, LAST_COMPLETED_BUILD, LAST_FAILED_BUILD, LAST_STABLE_BUILD, LAST_SUCCESSFUL_BUILD, LAST_UNSTABLE_BUILD, LAST_UNSUCCESSFUL_BUILD
-
-
Constructor Summary
Constructors Constructor Description PeepholePermalink()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract boolean
apply(Run<?,?> run)
Checks if the given build satisfies the peep-hole criteria.protected File
getPermalinkFile(Job<?,?> job)
Deprecated.No longer used.Run<?,?>
resolve(Job<?,?> job)
Resolves the permalink by using the cache if possible.boolean
test(Run<?,?> run)
protected void
updateCache(Job<?,?> job, Run<?,?> b)
Remembers the value 'n' in the cache for futureresolve(Job)
.-
Methods inherited from class hudson.model.PermalinkProjectAction.Permalink
getDisplayName, getId
-
-
-
-
Method Detail
-
apply
public abstract boolean apply(Run<?,?> run)
Checks if the given build satisfies the peep-hole criteria. This is the "G(B)" as described in the class javadoc.
-
getPermalinkFile
@Deprecated protected File getPermalinkFile(Job<?,?> job)
Deprecated.No longer used.
-
resolve
public Run<?,?> resolve(Job<?,?> job)
Resolves the permalink by using the cache if possible.- Specified by:
resolve
in classPermalinkProjectAction.Permalink
- Returns:
- null if the target of the permalink doesn't exist.
-
updateCache
protected void updateCache(@NonNull Job<?,?> job, @CheckForNull Run<?,?> b)
Remembers the value 'n' in the cache for futureresolve(Job)
.
-
-