Interface KeyValueStorageFactory

  • All Superinterfaces:
    java.lang.AutoCloseable, java.io.Closeable
    All Known Subinterfaces:
    PrivacyKeyValueStorageFactory

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

      • getName

        java.lang.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.
      • 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.