Package jenkins.fingerprints
Class FingerprintStorage
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<FingerprintStorage>
-
- jenkins.fingerprints.FingerprintStorage
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<FingerprintStorage>
- Direct Known Subclasses:
FileFingerprintStorage
@Restricted(org.kohsuke.accmod.restrictions.Beta.class) public abstract class FingerprintStorage extends AbstractDescribableImpl<FingerprintStorage> implements ExtensionPoint
Pluggable fingerprint storage API for fingerprints.- Author:
- Sumit Sarin
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description FingerprintStorage()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
cleanFingerprint(Fingerprint fingerprint, TaskListener taskListener)
This method performs the cleanup of the given fingerprint.abstract void
delete(String id)
Deletes the Fingerprint with the given unique ID.static FingerprintStorage
get()
Returns the configuredFingerprintStorage
engine chosen by the user for the system.FingerprintStorageDescriptor
getDescriptor()
By default looks for a nested class (conventionally namedDescriptorImpl
) implementingDescriptor
and marked withExtension
.static FingerprintStorage
getFileFingerprintStorage()
Deprecated.since 2.324, useExtensionList.lookupSingleton(FileFingerprintStorage.class)
instead.protected Fingerprint
getFingerprint(Fingerprint fp)
abstract boolean
isReady()
Returns true if there's some data in the fingerprint database.abstract void
iterateAndCleanupFingerprints(TaskListener taskListener)
Iterates a set of fingerprints, and cleans them up.abstract Fingerprint
load(String id)
Returns the Fingerprint with the given unique ID.abstract void
save(Fingerprint fp)
Saves the given Fingerprint in the storage.
-
-
-
Method Detail
-
get
public static FingerprintStorage get()
Returns the configuredFingerprintStorage
engine chosen by the user for the system.
-
getFileFingerprintStorage
@Deprecated public static FingerprintStorage getFileFingerprintStorage()
Deprecated.since 2.324, useExtensionList.lookupSingleton(FileFingerprintStorage.class)
instead.Returns the file system basedFileFingerprintStorage
configured on the system.
-
save
public abstract void save(Fingerprint fp) throws IOException
Saves the given Fingerprint in the storage. This acts as a blocking operation. For file system based default storage, throws IOException when it fails.- Throws:
IOException
- Save error
-
load
@CheckForNull public abstract Fingerprint load(String id) throws IOException
Returns the Fingerprint with the given unique ID. The unique ID for a fingerprint is defined byFingerprint.getHashString()
.- Throws:
IOException
- Load error
-
delete
public abstract void delete(String id) throws IOException
Deletes the Fingerprint with the given unique ID. This acts as a blocking operation. For file system based default storage, throws IOException when it fails. The unique ID for a fingerprint is defined byFingerprint.getHashString()
. TODO: Needed for external storage fingerprint cleanup.- Throws:
IOException
- Deletion error
-
isReady
public abstract boolean isReady()
Returns true if there's some data in the fingerprint database.
-
iterateAndCleanupFingerprints
public abstract void iterateAndCleanupFingerprints(TaskListener taskListener)
Iterates a set of fingerprints, and cleans them up. Cleaning up a fingerprint implies deleting the builds associated with the fingerprints, once they are no longer available on the system. If all the builds have been deleted, the fingerprint itself is deleted. This method is called periodically byFingerprintCleanupThread
. For reference, seeFileFingerprintStorage.iterateAndCleanupFingerprints(TaskListener)
For cleaning up the fingerprintcleanFingerprint(Fingerprint, TaskListener)
may be used.- Since:
- 2.246
-
cleanFingerprint
public boolean cleanFingerprint(@NonNull Fingerprint fingerprint, TaskListener taskListener)
This method performs the cleanup of the given fingerprint.- Since:
- 2.246
-
getFingerprint
protected Fingerprint getFingerprint(Fingerprint fp) throws IOException
- Throws:
IOException
-
getDescriptor
public FingerprintStorageDescriptor getDescriptor()
Description copied from class:AbstractDescribableImpl
By default looks for a nested class (conventionally namedDescriptorImpl
) implementingDescriptor
and marked withExtension
.Gets the descriptor for this instance.
Descriptor
is a singleton for every concreteDescribable
implementation, so ifa.getClass() == b.getClass()
then by defaulta.getDescriptor() == b.getDescriptor()
as well. (In rare cases a single implementation class may be used for instances with distinct descriptors.)- Specified by:
getDescriptor
in interfaceDescribable<FingerprintStorage>
- Overrides:
getDescriptor
in classAbstractDescribableImpl<FingerprintStorage>
- Since:
- 2.246
-
-