Class FingerprintStorage

java.lang.Object
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 Object implements Describable<FingerprintStorage>, ExtensionPoint
Pluggable fingerprint storage API for fingerprints.
Author:
Sumit Sarin
  • Constructor Details

    • FingerprintStorage

      public FingerprintStorage()
  • Method Details

    • get

      public static FingerprintStorage get()
      Returns the configured FingerprintStorage engine chosen by the user for the system.
    • getFileFingerprintStorage

      @Deprecated public static FingerprintStorage getFileFingerprintStorage()
      Deprecated.
      since 2.324, use ExtensionList.lookupSingleton(FileFingerprintStorage.class) instead.
      Returns the file system based FileFingerprintStorage 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 by Fingerprint.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 by Fingerprint.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 by FingerprintCleanupThread. For reference, see FileFingerprintStorage.iterateAndCleanupFingerprints(TaskListener) For cleaning up the fingerprint cleanFingerprint(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 interface: Describable
      Gets the descriptor for this instance.

      Descriptor is a singleton for every concrete Describable implementation, so if a.getClass() == b.getClass() then by default a.getDescriptor() == b.getDescriptor() as well. (In rare cases a single implementation class may be used for instances with distinct descriptors.)

      By default looks for a nested class (conventionally named DescriptorImpl) implementing Descriptor and marked with Extension.

      Specified by:
      getDescriptor in interface Describable<FingerprintStorage>
      Since:
      2.246