Package com.artipie.asto
Interface Storage
-
- All Known Subinterfaces:
Transaction
- All Known Implementing Classes:
FileStorage
,FileSystemTransaction
public interface Storage
The storage.You are supposed to implement this interface the way you want. It has to abstract the binary storage. You may use
FileStorage
if you want to work with files. Otherwise, for S3 or something else, you have to implement it yourself.- Since:
- 0.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CompletableFuture<Boolean>
exists(Key key)
This file exists?CompletableFuture<Collection<Key>>
list(String prefix)
Return the list of object names that start with this prefix, for example "foo/bar/".CompletableFuture<Void>
move(Key source, Key destination)
Moves value from one location to another.CompletableFuture<Void>
save(Key key, Flow.Publisher<ByteBuffer> content)
Saves the bytes to the specified key.CompletableFuture<Transaction>
transaction(List<Key> keys)
Start a transaction with specified keys.CompletableFuture<Flow.Publisher<ByteBuffer>>
value(Key key)
Obtain bytes by key.
-
-
-
Method Detail
-
exists
CompletableFuture<Boolean> exists(Key key)
This file exists?- Parameters:
key
- The key (file name)- Returns:
- TRUE if exists, FALSE otherwise
-
list
CompletableFuture<Collection<Key>> list(String prefix)
Return the list of object names that start with this prefix, for example "foo/bar/". The prefix must end with a slash.- Parameters:
prefix
- The prefix, ended with a slash- Returns:
- List of object keys/names
-
save
CompletableFuture<Void> save(Key key, Flow.Publisher<ByteBuffer> content)
Saves the bytes to the specified key.- Parameters:
key
- The keycontent
- Bytes to save- Returns:
- Completion or error signal.
-
move
CompletableFuture<Void> move(Key source, Key destination)
Moves value from one location to another.- Parameters:
source
- Source key.destination
- Destination key.- Returns:
- Completion or error signal.
-
value
CompletableFuture<Flow.Publisher<ByteBuffer>> value(Key key)
Obtain bytes by key.- Parameters:
key
- The key- Returns:
- Bytes.
-
transaction
CompletableFuture<Transaction> transaction(List<Key> keys)
Start a transaction with specified keys. These specified keys are the scope of a transaction. You will be able to perform storage operations likesave(Key, Flow.Publisher)
orvalue(Key)
only in the scope of a transaction.- Parameters:
keys
- The keys regarding which transaction is atomic- Returns:
- Transaction
-
-