Interface BackupProvider

All Superinterfaces:
AutoCloseable

public interface BackupProvider extends AutoCloseable
This interface defines the functionality required in order to create, store and manage Rama cluster backups. The primary requirements for a backup store are supporting storing objects by key and range queries.
  • Method Details

    • getObject

      <T extends InputStream> CompletableFuture<T> getObject(String key)
      Get the contents of the key stored in the backup provider. The contents are written to path.
      Parameters:
      key - the path at which to recover the contents.
      Returns:
      CompletableFuture that is completed with an input stream for the contents. The implementation MUST be non-blocking.
    • putObject

      CompletableFuture<Void> putObject(String key, InputStream contents, Long contentLength)
      Put the contents of path to the backup provider at the given key. If the path already exists, this should be a no-op.
      Parameters:
      key - the path at which to recover the contents.
      contents - an input-stream which provides the contents to upload.
      contentLength - the number of bytes in the contents input stream.
      Returns:
      CompletableFuture that is completed with an InputStream providing the contents. The implementation MUST be non-blocking. The provider should handle cancellation of the futures it returns by stopping uploads.
    • hasKey

      Predicate for key existing in the provider.
      Parameters:
      key - path to check for existence.
      Returns:
      CompletableFuture completed with existence status.
    • listKeysNonRecursive

      CompletableFuture<BackupProvider.KeysPage> listKeysNonRecursive(String prefix, String paginationKey, int pageSize)
      List all keys with the given prefix without recursing into sub-directories. Filenames are returned relative to the prefix. If the prefix ends in "/", then the contents of the path are returned, otherwise the prefix is treated as an object name.
      Parameters:
      prefix - the path to start listing keys.
      paginationKey - token controlling pagination.
      pageSize - the max number of results to return
      Returns:
      CompletableFuture that is delivered with a KeysPage instance. paginationKey should be be null on the initial call. On subsequent calls, pass the nextPageMarker returned by the previous call.
    • listKeysRecursive

      CompletableFuture<BackupProvider.KeysPage> listKeysRecursive(String prefix, String paginationKey)
      List all keys with the given prefix. If the prefix ends in "/", then the contents of the path are returned, otherwise the prefix is treated as an object name. The filenames are returned relative to the root.
      Parameters:
      prefix - the path to start listing keys.
      paginationKey - token controlling pagination.
      Returns:
      CompletableFuture that is delivered with a KeysPage instance. paginationKey should be be null on the initial call. On subsequent calls, pass the nextPageMarker returned by the previous call.
    • deleteObject

      CompletableFuture<Void> deleteObject(String key)
      Delete the object at the given key in the backup provider.
      Parameters:
      key - the path of the object to delete.
      Returns:
      CompletableFuture that is delivered when the delete completes. The implementation MUST be non-blocking.