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 DistributedPrimitive
Interface for all distributed primitives.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
DistributedPrimitive.Status
Status of distributed primitive.static class
DistributedPrimitive.Type
Type of distributed primitive.
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_OPERATION_TIMEOUT_MILLIS
Default timeout for primitive operations.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
addStatusChangeListener(java.util.function.Consumer<DistributedPrimitive.Status> listener)
Registers a listener to be called when the primitive's status changes.default ApplicationId
applicationId()
Returns the application owning this primitive.default java.util.concurrent.CompletableFuture<java.lang.Void>
destroy()
Purges state associated with this primitive.java.lang.String
name()
Returns the name of this primitive.DistributedPrimitive.Type
primitiveType()
Returns the type of primitive.default void
removeStatusChangeListener(java.util.function.Consumer<DistributedPrimitive.Status> listener)
Unregisters a previously registered listener to be called when the primitive's status changes.default java.util.Collection<java.util.function.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
java.lang.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 java.util.concurrent.CompletableFuture<java.lang.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:
CompletableFuture
that is completed when the operation completes
-
addStatusChangeListener
default void addStatusChangeListener(java.util.function.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(java.util.function.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 java.util.Collection<java.util.function.Consumer<DistributedPrimitive.Status>> statusChangeListeners()
Returns the collection of status change listeners previously registered.- Returns:
- collection of status change listeners
-
-