Interface PackagesStorage
-
public interface PackagesStorage
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.lang.Void>closeAsync()Close storage asynchronously.default java.lang.StringdataPath()The extra path for saving package data.java.util.concurrent.CompletableFuture<java.lang.Void>deleteAsync(java.lang.String path)Delete a file.java.util.concurrent.CompletableFuture<java.lang.Boolean>existAsync(java.lang.String path)Check the file is or not exists.voidinitialize()Initialize the packages management service with the given storage.java.util.concurrent.CompletableFuture<java.util.List<java.lang.String>>listAsync(java.lang.String path)List all the file under a path.java.util.concurrent.CompletableFuture<java.lang.Void>readAsync(java.lang.String path, java.io.OutputStream outputStream)Read a file to a output stream.java.util.concurrent.CompletableFuture<java.lang.Void>writeAsync(java.lang.String path, java.io.InputStream inputStream)Write a input stream to a path.
-
-
-
Method Detail
-
initialize
void initialize()
Initialize the packages management service with the given storage.
-
writeAsync
java.util.concurrent.CompletableFuture<java.lang.Void> writeAsync(java.lang.String path, java.io.InputStream inputStream)Write a input stream to a path.- Parameters:
path- file pathinputStream- the input file stream- Returns:
-
readAsync
java.util.concurrent.CompletableFuture<java.lang.Void> readAsync(java.lang.String path, java.io.OutputStream outputStream)Read a file to a output stream.- Parameters:
path- file pathoutputStream- the output file stream- Returns:
-
deleteAsync
java.util.concurrent.CompletableFuture<java.lang.Void> deleteAsync(java.lang.String path)
Delete a file.- Parameters:
path- file path- Returns:
-
listAsync
java.util.concurrent.CompletableFuture<java.util.List<java.lang.String>> listAsync(java.lang.String path)
List all the file under a path.- Parameters:
path- file path- Returns:
-
existAsync
java.util.concurrent.CompletableFuture<java.lang.Boolean> existAsync(java.lang.String path)
Check the file is or not exists.- Parameters:
path- file path- Returns:
-
closeAsync
java.util.concurrent.CompletableFuture<java.lang.Void> closeAsync()
Close storage asynchronously.- Returns:
-
dataPath
default java.lang.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
-
-