Package org.onosproject.store.service
Interface DistributedPrimitive
-
- All Known Subinterfaces:
AsyncAtomicCounter,AsyncAtomicCounterMap<K>,AsyncAtomicIdGenerator,AsyncAtomicValue<V>,AsyncConsistentMap<K,V>,AsyncConsistentMultimap<K,V>,AsyncConsistentTreeMap<V>,AsyncDistributedLock,AsyncDistributedSet<E>,AsyncDocumentTree<V>,AsyncLeaderElector,AtomicCounter,AtomicCounterMap<K>,AtomicIdGenerator,AtomicValue<V>,ConsistentMap<K,V>,ConsistentMultimap<K,V>,ConsistentTreeMap<V>,DistributedLock,DistributedSet<E>,DocumentTree<V>,EventuallyConsistentMap<K,V>,LeaderElector,Topic<T>,TransactionContext,WorkQueue<E>
- All Known Implementing Classes:
DefaultAtomicCounter,DefaultAtomicCounterMap,DefaultAtomicIdGenerator,DefaultAtomicValue,DefaultConsistentMap,DefaultConsistentMultimap,DefaultConsistentTreeMap,DefaultDistributedLock,DefaultDistributedSet,DefaultDocumentTree,DefaultLeaderElector,Synchronous
public interface DistributedPrimitiveInterface for all distributed primitives.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classDistributedPrimitive.StatusStatus of distributed primitive.static classDistributedPrimitive.TypeType of distributed primitive.
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_OPERATION_TIMEOUT_MILLISDefault timeout for primitive operations.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidaddStatusChangeListener(Consumer<DistributedPrimitive.Status> listener)Registers a listener to be called when the primitive's status changes.default ApplicationIdapplicationId()Returns the application owning this primitive.default CompletableFuture<Void>destroy()Purges state associated with this primitive.Stringname()Returns the name of this primitive.DistributedPrimitive.TypeprimitiveType()Returns the type of primitive.default voidremoveStatusChangeListener(Consumer<DistributedPrimitive.Status> listener)Unregisters a previously registered listener to be called when the primitive's status changes.default Collection<Consumer<DistributedPrimitive.Status>>statusChangeListeners()Returns the collection of status change listeners previously registered.
-
-
-
Field Detail
-
DEFAULT_OPERATION_TIMEOUT_MILLIS
static final long DEFAULT_OPERATION_TIMEOUT_MILLIS
Default timeout for primitive operations.- See Also:
- Constant Field Values
-
-
Method Detail
-
name
String name()
Returns the name of this primitive.- Returns:
- name
-
primitiveType
DistributedPrimitive.Type primitiveType()
Returns the type of primitive.- Returns:
- primitive type
-
applicationId
default ApplicationId applicationId()
Returns the application owning this primitive.- Returns:
- application id
-
destroy
default CompletableFuture<Void> destroy()
Purges state associated with this primitive.Implementations can override and provide appropriate clean up logic for purging any state state associated with the primitive. Whether modifications made within the destroy method have local or global visibility is left unspecified.
- Returns:
CompletableFuturethat is completed when the operation completes
-
addStatusChangeListener
default void addStatusChangeListener(Consumer<DistributedPrimitive.Status> listener)
Registers a listener to be called when the primitive's status changes.- Parameters:
listener- The listener to be called when the status changes.
-
removeStatusChangeListener
default void removeStatusChangeListener(Consumer<DistributedPrimitive.Status> listener)
Unregisters a previously registered listener to be called when the primitive's status changes.- Parameters:
listener- The listener to unregister
-
statusChangeListeners
default Collection<Consumer<DistributedPrimitive.Status>> statusChangeListeners()
Returns the collection of status change listeners previously registered.- Returns:
- collection of status change listeners
-
-