Interface PackagesStorage


public interface PackagesStorage
  • Method Details

    • initialize

      void initialize()
      Initialize the packages management service with the given storage.
    • writeAsync

      CompletableFuture<Void> writeAsync(String path, InputStream inputStream)
      Write a input stream to a path.
      Parameters:
      path - file path
      inputStream - the input file stream
      Returns:
    • readAsync

      CompletableFuture<Void> readAsync(String path, OutputStream outputStream)
      Read a file to a output stream.
      Parameters:
      path - file path
      outputStream - the output file stream
      Returns:
    • deleteAsync

      CompletableFuture<Void> deleteAsync(String path)
      Delete a file.
      Parameters:
      path - file path
      Returns:
    • listAsync

      CompletableFuture<List<String>> listAsync(String path)
      List all the file under a path.
      Parameters:
      path - file path
      Returns:
    • existAsync

      CompletableFuture<Boolean> existAsync(String path)
      Check the file is or not exists.
      Parameters:
      path - file path
      Returns:
    • closeAsync

      CompletableFuture<Void> closeAsync()
      Close storage asynchronously.
      Returns:
    • dataPath

      default String dataPath()
      The extra path for saving package data. For example, we have a package function://public/default/package@v0.1, it will save the meta to the path function/public/default/package/v0.1/meta, and save the data to the path function/public/default/package/v0.1. By default, we are using distributed log as the package storage, and it supports saving data at a directory. But some storage like filesystem don't have the similar ability, it needs another path for saving the data. This api provides the ability to support saving the data in another place. If you specify the data path as `/data`, the package will saved into function/public/default/package/v0.1/data.
      Returns:
      the data path