Package discord4j.store.api.primitive
Class ForwardingStore<V>
- java.lang.Object
-
- discord4j.store.api.primitive.ForwardingStore<V>
-
- All Implemented Interfaces:
LongObjStore<V>,ReadOnlyStore<Long,V>,Store<Long,V>
public class ForwardingStore<V> extends Object implements LongObjStore<V>
An implementation ofLongObjStorewhich is a data connection that delegates to another, generic one.- See Also:
LongObjStore
-
-
Constructor Summary
Constructors Constructor Description ForwardingStore(Store<Long,V> toForward)Constructs the data connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Mono<Long>count()Retrieves the amount of stored values in the data source currently.Mono<Void>delete(long id)Deletes a value associated with the provided id.Mono<Void>delete(Long id)Deletes a value associated with the provided id.Mono<Void>delete(Publisher<Long> ids)Deletes the values associated with the provided ids.Mono<Void>deleteAll()Deletes all entries in the data source.Mono<Void>deleteInRange(long start, long end)Deletes values within a range of ids.Mono<Void>deleteInRange(Long start, Long end)Deletes values within a range of ids.Flux<Tuple2<Long,V>>entries()Gets a stream of all entries in the data source.Mono<V>find(long id)Attempts to find the value associated with the provided id.Mono<V>find(Long id)Attempts to find the value associated with the provided id.Flux<V>findInRange(long start, long end)Retrieves all stored values with ids within a provided range.Flux<V>findInRange(Long start, Long end)Retrieves all stored values with ids within a provided range.protected Store<Long,V>getOriginal()Gets the original, generic data connection.Mono<Void>invalidate()Invalidates the contents of the store.Flux<Long>keys()Gets a stream of all keys in the data source.Flux<LongObjTuple2<V>>longObjEntries()Gets a stream of all entries in the data source.Mono<Void>save(Long key, V value)Stores a key value pair.Mono<Void>save(Publisher<Tuple2<Long,V>> entryStream)Stores key value pairs.Mono<Void>saveWithLong(long key, V value)Stores a key value pair.Mono<Void>saveWithLong(Publisher<LongObjTuple2<V>> entryStream)Stores key value pairs.StringtoString()Flux<V>values()Gets a stream of all values in the data source.
-
-
-
Method Detail
-
getOriginal
protected Store<Long,V> getOriginal()
Gets the original, generic data connection.- Returns:
- The original data connection.
-
save
public Mono<Void> save(Long key, V value)
Description copied from interface:StoreStores a key value pair.
-
saveWithLong
public Mono<Void> saveWithLong(long key, V value)
Description copied from interface:LongObjStoreStores a key value pair.- Specified by:
saveWithLongin interfaceLongObjStore<V>- Parameters:
key- The key representing the value.value- The value.- Returns:
- A mono which signals the completion of the storage of the pair.
-
save
public Mono<Void> save(Publisher<Tuple2<Long,V>> entryStream)
Description copied from interface:StoreStores key value pairs.
-
saveWithLong
public Mono<Void> saveWithLong(Publisher<LongObjTuple2<V>> entryStream)
Description copied from interface:LongObjStoreStores key value pairs.- Specified by:
saveWithLongin interfaceLongObjStore<V>- Parameters:
entryStream- A flux providing the key value pairs.- Returns:
- A mono which signals the completion of the storage of the pairs.
-
find
public Mono<V> find(Long id)
Description copied from interface:ReadOnlyStoreAttempts to find the value associated with the provided id.- Specified by:
findin interfaceLongObjStore<V>- Specified by:
findin interfaceReadOnlyStore<Long,V>- Parameters:
id- The id to search with.- Returns:
- A mono, which may or may not contain an associated object.
-
find
public Mono<V> find(long id)
Description copied from interface:LongObjStoreAttempts to find the value associated with the provided id.- Specified by:
findin interfaceLongObjStore<V>- Parameters:
id- The id to search with.- Returns:
- A mono, which may or may not contain an associated object.
-
findInRange
public Flux<V> findInRange(Long start, Long end)
Description copied from interface:ReadOnlyStoreRetrieves all stored values with ids within a provided range.- Specified by:
findInRangein interfaceLongObjStore<V>- Specified by:
findInRangein interfaceReadOnlyStore<Long,V>- Parameters:
start- The starting key (inclusive).end- The ending key (exclusive).- Returns:
- The stream of values with ids within the provided range.
-
findInRange
public Flux<V> findInRange(long start, long end)
Description copied from interface:LongObjStoreRetrieves all stored values with ids within a provided range.- Specified by:
findInRangein interfaceLongObjStore<V>- Parameters:
start- The starting key (inclusive).end- The ending key (exclusive).- Returns:
- The stream of values with ids within the provided range.
-
count
public Mono<Long> count()
Description copied from interface:ReadOnlyStoreRetrieves the amount of stored values in the data source currently.- Specified by:
countin interfaceReadOnlyStore<Long,V>- Returns:
- A mono which provides the amount of stored values.
-
delete
public Mono<Void> delete(Long id)
Description copied from interface:StoreDeletes a value associated with the provided id.
-
delete
public Mono<Void> delete(long id)
Description copied from interface:LongObjStoreDeletes a value associated with the provided id.- Specified by:
deletein interfaceLongObjStore<V>- Parameters:
id- The id of the value to delete.- Returns:
- A mono which signals the completion of the deletion of the value.
-
delete
public Mono<Void> delete(Publisher<Long> ids)
Description copied from interface:StoreDeletes the values associated with the provided ids.
-
deleteInRange
public Mono<Void> deleteInRange(Long start, Long end)
Description copied from interface:StoreDeletes values within a range of ids.- Specified by:
deleteInRangein interfaceLongObjStore<V>- Specified by:
deleteInRangein interfaceStore<Long,V>- Parameters:
start- The starting key (inclusive).end- The ending key (exclusive).- Returns:
- A mono which signals the completion of the deletion of values.
-
deleteInRange
public Mono<Void> deleteInRange(long start, long end)
Description copied from interface:LongObjStoreDeletes values within a range of ids.- Specified by:
deleteInRangein interfaceLongObjStore<V>- Parameters:
start- The starting key (inclusive).end- The ending key (exclusive).- Returns:
- A mono which signals the completion of the deletion of values.
-
deleteAll
public Mono<Void> deleteAll()
Description copied from interface:StoreDeletes all entries in the data source.
-
keys
public Flux<Long> keys()
Description copied from interface:ReadOnlyStoreGets a stream of all keys in the data source.- Specified by:
keysin interfaceReadOnlyStore<Long,V>- Returns:
- The stream of keys stored.
-
values
public Flux<V> values()
Description copied from interface:ReadOnlyStoreGets a stream of all values in the data source.- Specified by:
valuesin interfaceReadOnlyStore<Long,V>- Returns:
- The stream of values stored.
-
entries
public Flux<Tuple2<Long,V>> entries()
Description copied from interface:ReadOnlyStoreGets a stream of all entries in the data source.- Specified by:
entriesin interfaceLongObjStore<V>- Specified by:
entriesin interfaceReadOnlyStore<Long,V>- Returns:
- The stream of all entries stored.
-
invalidate
public Mono<Void> invalidate()
Description copied from interface:StoreInvalidates the contents of the store. Once this is invoked, there is no longer a guarantee that the data in the store is reliable.- Specified by:
invalidatein interfaceStore<Long,V>- Returns:
- A mono which signals the completion of the invalidation of all values.
-
longObjEntries
public Flux<LongObjTuple2<V>> longObjEntries()
Description copied from interface:LongObjStoreGets a stream of all entries in the data source.- Specified by:
longObjEntriesin interfaceLongObjStore<V>- Returns:
- The stream of all entries stored.
-
-