Package discord4j.store.api.service
Interface StoreService
-
- All Known Implementing Classes:
ChronicleStoreService
,ForwardingStoreService
,JdkStoreService
,NoOpStoreService
,RedisStoreService
@Service public interface StoreService
This represents a java service which provides stores. This can be loaded viaStoreServiceLoader
or it may be loaded manually.- See Also:
ServiceLoader
, Servicer,StoreServiceLoader
,NoOpStoreService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description reactor.core.publisher.Mono<Void>
dispose()
This is a lifecycle method called to signal that a store should dispose of any resources due to an abrupt close (hard reconnect or disconnect).boolean
hasGenericStores()
This is used to check if this service can provide generic stores.boolean
hasLongObjStores()
This is used to check if this service can provide long-object stores.reactor.core.publisher.Mono<Void>
init(StoreContext context)
This is a lifecycle method called to signal that a store should allocate any necessary resources.default int
order()
Returns an arbitrary order for this service.<K extends Comparable<K>,V extends Serializable>
Store<K,V>provideGenericStore(Class<K> keyClass, Class<V> valueClass)
This is called to provide a new store instance for the provided configuration.<V extends Serializable>
LongObjStore<V>provideLongObjStore(Class<V> valueClass)
This is called to provide a new store instance with a long key and object values.
-
-
-
Method Detail
-
order
default int order()
Returns an arbitrary order for this service. This is used for automated service discovery in the case that multiple services are present. Conventions: 0 = neutral priority,Integer.MAX_VALUE
= lowest priority,Integer.MIN_VALUE
= highest priority.- Returns:
- The priority of this service, 0 by default.
-
hasGenericStores
boolean hasGenericStores()
This is used to check if this service can provide generic stores.- Returns:
- True if possible, else false.
- See Also:
Store
-
provideGenericStore
<K extends Comparable<K>,V extends Serializable> Store<K,V> provideGenericStore(Class<K> keyClass, Class<V> valueClass)
This is called to provide a new store instance for the provided configuration.- Type Parameters:
K
- The key type which provides a 1:1 mapping to the value type. This type is also expected to beComparable
in order to allow for range operations.V
- The value type, these follow JavaBean conventions.- Parameters:
keyClass
- The class of the keys.valueClass
- The class of the values.- Returns:
- The instance of the store.
-
hasLongObjStores
boolean hasLongObjStores()
This is used to check if this service can provide long-object stores.- Returns:
- True if possible, else false.
- See Also:
LongObjStore
-
provideLongObjStore
<V extends Serializable> LongObjStore<V> provideLongObjStore(Class<V> valueClass)
This is called to provide a new store instance with a long key and object values.- Type Parameters:
V
- The value type, these follow JavaBean conventions.- Parameters:
valueClass
- The class of the values.- Returns:
- The instance of the store.
-
init
reactor.core.publisher.Mono<Void> init(StoreContext context)
This is a lifecycle method called to signal that a store should allocate any necessary resources.- Parameters:
context
- Some context about the environment which this service is being utilized in.- Returns:
- A mono, whose completion signals that resources have been allocated successfully.
-
dispose
reactor.core.publisher.Mono<Void> dispose()
This is a lifecycle method called to signal that a store should dispose of any resources due to an abrupt close (hard reconnect or disconnect).- Returns:
- A mono, whose completion signals that resources have been released successfully.
-
-