Class ManifestDatabase

java.lang.Object
io.bdeploy.bhive.objects.LockableDatabase
io.bdeploy.bhive.objects.ManifestDatabase
All Implemented Interfaces:
AutoCloseable

public class ManifestDatabase extends LockableDatabase implements AutoCloseable
Stores and manages Manifests. Storage happens in files distributed in a database based on name and tag of each Manifest. This allows concurrent updates to the database even from different processes.
  • Constructor Details

    • ManifestDatabase

      public ManifestDatabase(Path root)
      Parameters:
      root - the root path of the database, created empty if it does not yet exist
  • Method Details

    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • addSpawnListener

      public void addSpawnListener(ManifestSpawnListener listener)
    • removeSpawnListener

      public void removeSpawnListener(ManifestSpawnListener listener)
    • scheduleNotify

      public void scheduleNotify(Manifest.Key key)
    • hasManifest

      public boolean hasManifest(Manifest.Key key)
      Parameters:
      key - the manifest key to check
      Returns:
      whether the Manifest exists in the database.
    • addManifest

      public void addManifest(Manifest manifest)
      Concurrent-save adds a Manifest to the database.
      Parameters:
      manifest - the manifest to store in the database.
    • removeManifest

      public void removeManifest(Manifest.Key key)
      Concurrent-save removes a manifest from the database. Does not remove underlying objects from any ObjectDatabase, just removes the manifest entry (which is the "root-anchor" to those objects).
      Parameters:
      key - the manifest to remove
    • getAllManifests

      public Set<Manifest.Key> getAllManifests()
      Returns:
      all Manifest.Keys found in the database's filesystem.
    • getAllForName

      public Set<Manifest.Key> getAllForName(String name)
      Parameters:
      name - the name to collect for. May be any number of name segments (must be complete segments). e.g 'my/manifest' will match the same (but potentially more) than 'my/manifest/name', but none of the two will match 'my/manifestname'. If the name includes a ':', it is treated as a fully qualified manifest key.
      Returns:
      the list of manifests which matched the name.
    • getManifest

      public Manifest getManifest(Manifest.Key key)
      Parameters:
      key - the key of the manifest to load
      Returns:
      the Manifest loaded from its backing file.
    • invalidateCaches

      public void invalidateCaches()
      Invalidates all cached data.