public interface StorageService<TKey,T extends ObjectWithId<TKey>,TDataStore> extends Component<TKey,TDataStore>
| Modifier and Type | Method and Description |
|---|---|
java.util.concurrent.CompletableFuture<java.lang.Boolean> |
deleteOne(java.time.Instant createdUtc)
Attempts to delete the first
document where
Instant.getEpochSecond() retrieved from
ObjectWithId.getCreatedUtc() is equal to
Instant.getEpochSecond() of the provided
Instant |
java.util.concurrent.CompletableFuture<java.lang.Boolean> |
deleteOne(TKey id)
Attempts to delete a matching
document with
the provided id |
T |
generateEmpty() |
java.util.concurrent.CompletableFuture<java.util.List<T>> |
getAll() |
java.util.concurrent.CompletableFuture<java.util.List<TKey>> |
getAllIds() |
java.util.concurrent.CompletableFuture<java.util.Optional<T>> |
getOne(java.time.Instant createdUtc)
Attempts to find the first
document where
Instant.getEpochSecond() retrieved from
ObjectWithId.getCreatedUtc() is equal to
Instant.getEpochSecond() of the provided
Instant |
java.util.concurrent.CompletableFuture<java.util.Optional<T>> |
getOne(TKey id)
Attempts to find a matching
document with
the provided id |
java.lang.Class<T> |
getTClass() |
java.util.concurrent.CompletableFuture<java.util.List<T>> |
insert(java.util.List<T> list) |
java.util.concurrent.CompletableFuture<java.util.Optional<T>> |
insertOne(T item) |
java.util.concurrent.CompletableFuture<java.lang.Boolean> |
parseAndDeleteOne(java.lang.Object idOrTime)
Attempts to delete a matching
document by
parsing provided Object. |
java.util.concurrent.CompletableFuture<java.util.Optional<T>> |
parseAndGetOne(java.lang.Object idOrTime)
Attempts to find a matching
document by
parsing provided Object. |
getDataStoreContext, getTKeyClass, parse, parseUnsafeT generateEmpty()
Tjava.lang.Class<T> getTClass()
java.util.concurrent.CompletableFuture<java.util.Optional<T>> insertOne(T item)
item - document to insertOptional containing the inserted document
if successful, otherwise Optional.empty()java.util.concurrent.CompletableFuture<java.util.List<T>> insert(java.util.List<T> list)
list - List of documents to insertList of all documents that were successfully insertedjava.util.concurrent.CompletableFuture<java.util.List<TKey>> getAllIds()
List of all ids in the repositoryjava.util.concurrent.CompletableFuture<java.util.List<T>> getAll()
List of all documents in the repositoryjava.util.concurrent.CompletableFuture<java.util.Optional<T>> getOne(TKey id)
document with
the provided idid - TKey to query repository withOptional containing a matching document
if successful, otherwise Optional.empty()java.util.concurrent.CompletableFuture<java.util.Optional<T>> getOne(java.time.Instant createdUtc)
document where
Instant.getEpochSecond() retrieved from
ObjectWithId.getCreatedUtc() is equal to
Instant.getEpochSecond() of the provided
InstantcreatedUtc - Instant to query repository withOptional containing if successful,
otherwise Optional.empty()java.util.concurrent.CompletableFuture<java.util.Optional<T>> parseAndGetOne(java.lang.Object idOrTime)
document by
parsing provided Object.
Will first attempt to parse the provided Object
as an id. If parsing is successful, will return the
result of getOne(Object).
If parsing as an id is unsuccessful, will attempt to parse
the provided Object as createdUtc. If parsing is successful,
will return the result of getOne(Instant)
Note: if id parsing is successful but no document is found, will not attempt to parse as time
idOrTime - Object to parse. Can be an actual instance of
TKey or a String representation. Can
also be wrapped in an OptionalOptional containing a matching document
if successful, otherwise Optional.empty()Component.parseUnsafe(Object),
Component.parse(Object),
TimeFormatService.parseInstantUnsafe(String),
TimeFormatService.parseInstant(String)java.util.concurrent.CompletableFuture<java.lang.Boolean> deleteOne(TKey id)
document with
the provided idid - TKey to query repository withjava.util.concurrent.CompletableFuture<java.lang.Boolean> deleteOne(java.time.Instant createdUtc)
document where
Instant.getEpochSecond() retrieved from
ObjectWithId.getCreatedUtc() is equal to
Instant.getEpochSecond() of the provided
InstantcreatedUtc - Instant to query repository withdocument was found and deletedjava.util.concurrent.CompletableFuture<java.lang.Boolean> parseAndDeleteOne(java.lang.Object idOrTime)
document by
parsing provided Object.
Will first attempt to parse the provided Object
as an id. If parsing is successful, will return the
result of deleteOne(Object).
If parsing as an id is unsuccessful, will attempt to parse
the provided Object as createdUtc. If parsing is successful,
will return the result of deleteOne(Instant)
Note: if id parsing is successful but no document is found, will not attempt to parse as time
idOrTime - Object to parse. Can be an actual instance of
TKey or a String representation. Can
also be wrapped in an Optionaldocument was found and deletedComponent.parseUnsafe(Object),
Component.parse(Object),
TimeFormatService.parseInstantUnsafe(String),
TimeFormatService.parseInstant(String)