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