Interface KeyValueStorageFactory

All Superinterfaces:
AutoCloseable, Closeable

public interface KeyValueStorageFactory extends Closeable
Factory for creating key-value storage instances.
  • Method Details

    • getName

      String getName()
      Retrieves the identity of the key-value storage factory.
      Returns:
      the storage identifier, used when selecting the appropriate storage service.
    • create

      KeyValueStorage create(SegmentIdentifier segment, BesuConfiguration configuration, MetricsSystem metricsSystem) throws StorageException
      Creates a new key-value storage instance, appropriate for the given segment.

      When segment isolation is not supported, the create will still be called with each of the required segments, where the same storage instance should be returned.

      New segments may be introduced in future releases and should result in a new empty key-space. Segments created with the identifier of an existing segment should have the same data as that existing segment.

      Parameters:
      segment - identity of the isolation segment, an identifier for the data set the storage will contain.
      configuration - common configuration available to plugins, in a populated state.
      metricsSystem - metrics component for recording key-value storage events.
      Returns:
      the storage instance reserved for the given segment.
      Throws:
      StorageException - problem encountered when creating storage for the segment.
    • create

      SegmentedKeyValueStorage create(List<SegmentIdentifier> segments, BesuConfiguration configuration, MetricsSystem metricsSystem) throws StorageException
      Creates a new segmented key-value storage instance, appropriate for the given segment.

      New segments may be introduced in future releases and should result in a new empty key-space. Segments created with the identifier of an existing segment should have the same data as that existing segment.

      Parameters:
      segments - list of segments identifiers that comprise the created segmented storage.
      configuration - common configuration available to plugins, in a populated state.
      metricsSystem - metrics component for recording key-value storage events.
      Returns:
      the storage instance reserved for the given segment.
      Throws:
      StorageException - problem encountered when creating storage for the segment.
    • isSegmentIsolationSupported

      boolean isSegmentIsolationSupported()
      Whether storage segment isolation is supported by the factory created instances.

      As supporting segment isolation is similar to a separating keys into distinct namespaces, where operations only affect within that segment i.e. the same key from two segments point to separate values.

      Returns:
      true when the created storage instances are isolated from each other, false when keys of different segments can collide with each other.
    • isSnapshotIsolationSupported

      boolean isSnapshotIsolationSupported()
      Whether storage supports repeatable reads AKA snapshots.
      Returns:
      true when the created storage supports snapshots false when it does not.