Interface MetadataStore

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      java.util.concurrent.CompletableFuture<java.lang.Void> delete​(java.lang.String path, java.util.Optional<java.lang.Long> expectedVersion)  
      java.util.concurrent.CompletableFuture<java.lang.Void> deleteRecursive​(java.lang.String path)
      Delete a key-value pair and all the children nodes.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> exists​(java.lang.String path)
      Read whether a specific path exists.
      java.util.concurrent.CompletableFuture<java.util.Optional<GetResult>> get​(java.lang.String path)
      Read the value of one key, identified by the path The async call will return a future that yields a GetResult that will contain the value and the associated Stat object.
      java.util.concurrent.CompletableFuture<java.util.List<java.lang.String>> getChildren​(java.lang.String path)
      Return all the nodes (lexicographically sorted) that are children to the specific path.
      default MetadataCacheConfig getDefaultMetadataCacheConfig()
      Returns the default metadata cache config.
      default <T> MetadataCache<T> getMetadataCache​(com.fasterxml.jackson.core.type.TypeReference<T> typeRef)
      Create a metadata cache specialized for a specific class.
      <T> MetadataCache<T> getMetadataCache​(com.fasterxml.jackson.core.type.TypeReference<T> typeRef, MetadataCacheConfig cacheConfig)
      Create a metadata cache specialized for a specific class.
      default <T> MetadataCache<T> getMetadataCache​(java.lang.Class<T> clazz)
      Create a metadata cache specialized for a specific class.
      <T> MetadataCache<T> getMetadataCache​(java.lang.Class<T> clazz, MetadataCacheConfig cacheConfig)
      Create a metadata cache specialized for a specific class.
      default <T> MetadataCache<T> getMetadataCache​(MetadataSerde<T> serde)
      Create a metadata cache that uses a particular serde object.
      <T> MetadataCache<T> getMetadataCache​(MetadataSerde<T> serde, MetadataCacheConfig cacheConfig)
      Create a metadata cache that uses a particular serde object.
      java.util.concurrent.CompletableFuture<Stat> put​(java.lang.String path, byte[] value, java.util.Optional<java.lang.Long> expectedVersion)
      Put a new value for a given key.
      void registerListener​(java.util.function.Consumer<Notification> listener)
      Register a listener that will be called on changes in the underlying store.
      • Methods inherited from interface java.lang.AutoCloseable

        close
    • Method Detail

      • get

        java.util.concurrent.CompletableFuture<java.util.Optional<GetResult>> get​(java.lang.String path)
        Read the value of one key, identified by the path The async call will return a future that yields a GetResult that will contain the value and the associated Stat object. If the value is not found, the future will yield an empty Optional.
        Parameters:
        path - the path of the key to get from the store
        Returns:
        a future to track the async request
      • getChildren

        java.util.concurrent.CompletableFuture<java.util.List<java.lang.String>> getChildren​(java.lang.String path)
        Return all the nodes (lexicographically sorted) that are children to the specific path. If the path itself does not exist, it will return an empty list.
        Parameters:
        path - the path of the key to get from the store
        Returns:
        a future to track the async request
      • exists

        java.util.concurrent.CompletableFuture<java.lang.Boolean> exists​(java.lang.String path)
        Read whether a specific path exists. Note: In case of keys with multiple levels (eg: '/a/b/c'), checking the existence of a parent (eg. '/a') might not necessarily return true, unless the key had been explicitly created.
        Parameters:
        path - the path of the key to check on the store
        Returns:
        a future to track the async request
      • put

        java.util.concurrent.CompletableFuture<Stat> put​(java.lang.String path,
                                                         byte[] value,
                                                         java.util.Optional<java.lang.Long> expectedVersion)
        Put a new value for a given key. The caller can specify an expected version to be atomically checked against the current version of the stored data. The future will return the Stat object associated with the newly inserted value.
        Parameters:
        path - the path of the key to delete from the store
        value - the value to
        expectedVersion - if present, the version will have to match with the currently stored value for the operation to succeed. Use -1 to enforce a non-existing value.
        Returns:
        a future to track the async request
        Throws:
        MetadataStoreException.BadVersionException - if the expected version doesn't match the actual version of the data
      • delete

        java.util.concurrent.CompletableFuture<java.lang.Void> delete​(java.lang.String path,
                                                                      java.util.Optional<java.lang.Long> expectedVersion)
        Parameters:
        path - the path of the key to delete from the store
        expectedVersion - if present, the version will have to match with the currently stored value for the operation to succeed
        Returns:
        a future to track the async request
        Throws:
        MetadataStoreException.NotFoundException - if the path is not found
        MetadataStoreException.BadVersionException - if the expected version doesn't match the actual version of the data
      • deleteRecursive

        java.util.concurrent.CompletableFuture<java.lang.Void> deleteRecursive​(java.lang.String path)
        Delete a key-value pair and all the children nodes. Note: the operation might not be carried in an atomic fashion. If the operation fails, the deletion of the tree might be only partial.
        Parameters:
        path - the path of the key to delete from the store
        Returns:
        a future to track the async request
      • registerListener

        void registerListener​(java.util.function.Consumer<Notification> listener)
        Register a listener that will be called on changes in the underlying store.
        Parameters:
        listener - a consumer of notifications
      • getMetadataCache

        <T> MetadataCache<T> getMetadataCache​(java.lang.Class<T> clazz,
                                              MetadataCacheConfig cacheConfig)
        Create a metadata cache specialized for a specific class.
        Type Parameters:
        T -
        Parameters:
        clazz - the class type to be used for serialization/deserialization
        cacheConfig - the cache configuration to be used
        Returns:
        the metadata cache object
      • getMetadataCache

        default <T> MetadataCache<T> getMetadataCache​(java.lang.Class<T> clazz)
        Create a metadata cache specialized for a specific class.
        Type Parameters:
        T -
        Parameters:
        clazz - the class type to be used for serialization/deserialization
        Returns:
        the metadata cache object
      • getMetadataCache

        <T> MetadataCache<T> getMetadataCache​(com.fasterxml.jackson.core.type.TypeReference<T> typeRef,
                                              MetadataCacheConfig cacheConfig)
        Create a metadata cache specialized for a specific class.
        Type Parameters:
        T -
        Parameters:
        typeRef - the type ref description to be used for serialization/deserialization
        cacheConfig - the cache configuration to be used
        Returns:
        the metadata cache object
      • getMetadataCache

        default <T> MetadataCache<T> getMetadataCache​(com.fasterxml.jackson.core.type.TypeReference<T> typeRef)
        Create a metadata cache specialized for a specific class.
        Type Parameters:
        T -
        Parameters:
        typeRef - the type ref description to be used for serialization/deserialization
        Returns:
        the metadata cache object
      • getMetadataCache

        <T> MetadataCache<T> getMetadataCache​(MetadataSerde<T> serde,
                                              MetadataCacheConfig cacheConfig)
        Create a metadata cache that uses a particular serde object.
        Type Parameters:
        T -
        Parameters:
        serde - the custom serialization/deserialization object
        cacheConfig - the cache configuration to be used
        Returns:
        the metadata cache object
      • getMetadataCache

        default <T> MetadataCache<T> getMetadataCache​(MetadataSerde<T> serde)
        Create a metadata cache that uses a particular serde object.
        Type Parameters:
        T -
        Parameters:
        serde - the custom serialization/deserialization object
        Returns:
        the metadata cache object
      • getDefaultMetadataCacheConfig

        default MetadataCacheConfig getDefaultMetadataCacheConfig()
        Returns the default metadata cache config.
        Returns:
        default metadata cache config