Package io.deephaven.engine.updategraph
Interface UpdateGraph
- All Superinterfaces:
LogOutputAppendable
,NotificationQueue
,NotificationQueue.Dependency
,UpdateSourceRegistrar
- All Known Implementing Classes:
BaseUpdateGraph
,EventDrivenUpdateGraph
,PeriodicUpdateGraph
,PoisonedUpdateGraph
public interface UpdateGraph
extends UpdateSourceRegistrar, NotificationQueue, NotificationQueue.Dependency
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.engine.updategraph.NotificationQueue
NotificationQueue.Dependency, NotificationQueue.ErrorNotification, NotificationQueue.Notification
-
Method Summary
Modifier and TypeMethodDescriptiondefault <RETURN_TYPE,
EXCEPTION_TYPE extends Exception>
RETURN_TYPEallowSerialTableOperations
(@NotNull ThrowingSupplier<RETURN_TYPE, EXCEPTION_TYPE> operation) User or engine code that is certain a particular table operation is safe to execute with respect to this UpdateGraph may use this method to follow the prescribed pattern for declaring safety and reinstating the priority safety parameters.default <RETURN_TYPE>
RETURN_TYPEallowSerialTableOperations
(@NotNull Supplier<RETURN_TYPE> operation) User or engine code that is certain a particular table operation is safe to execute with respect to this UpdateGraph may use this method to follow the prescribed pattern for declaring safety and reinstating the priority safety parameters.default <UG_TYPE extends UpdateGraph>
UG_TYPEcast()
Castthis
to a more specific UpdateGraph type, in order to access implementation-specific methods.default void
If we initiate a serial (not annotated as concurrent) table operation that should update using this UpdateGraph without holding the appropriate lock, then we are likely committing a grievous error, but one that will only occasionally result in us getting the wrong answer or if we are lucky an assertion.clock()
boolean
Test if the current thread is involved in processing updates for this UpdateGraph.getName()
int
Retrieve the number of independent update propagation tasks this UpdateGraph can process concurrently.void
Request that this UpdateGraph process any pending updates as soon as practicable.default void
requestSignal
(Condition exclusiveLockCondition) Request that aCondition
derived from this UpdateGraph'sexclusiveLock()
besignalled
in a safe manner.boolean
Test if engine code executing on the current thread should assume safety for serial table operations.boolean
setSerialTableOperationsSafe
(boolean newValue) User or engine code that makes its own determination about the safety of initiating serial table operations on the current thread may use this method to override default behavior.void
stop()
Attempt to stop this update graph, and cease processing further notifications.boolean
Methods inherited from interface io.deephaven.base.log.LogOutputAppendable
append
Methods inherited from interface io.deephaven.engine.updategraph.NotificationQueue
addNotification, addNotifications, maybeAddNotification
Methods inherited from interface io.deephaven.engine.updategraph.NotificationQueue.Dependency
getUpdateGraph, getUpdateGraph, satisfied
Methods inherited from interface io.deephaven.engine.updategraph.UpdateSourceRegistrar
addSource, removeSource, removeSources
-
Method Details
-
getName
String getName()- Returns:
- The name of this UpdateGraph
-
exclusiveLock
AwareFunctionalLock exclusiveLock()- Returns:
- The exclusive
AwareFunctionalLock
to use with this update graph
-
clock
LogicalClock clock()- Returns:
- The
LogicalClock
to use with this update graph
-
parallelismFactor
int parallelismFactor()Retrieve the number of independent update propagation tasks this UpdateGraph can process concurrently.For example, an implementation using a fixed-size thread pool of update task workers should return the size of the thread pool.
This is exposed in order to allow users to determine the ideal way to partition their queries for maximum parallelism without undue overhead.
- Returns:
- number of independent update propagation tasks this UpdateGraph can process concurrently
-
cast
Castthis
to a more specific UpdateGraph type, in order to access implementation-specific methods.- Type Parameters:
UG_TYPE
- The UpdateGraph type to cast to- Returns:
this
-
logDependencies
LogEntry logDependencies()- Returns:
- A LogEntry that may be prefixed with UpdateGraph information
-
currentThreadProcessesUpdates
boolean currentThreadProcessesUpdates()Test if the current thread is involved in processing updates for this UpdateGraph. If so, non-terminal user notifications on the current thread must not attempt to lock this UpdateGraph.- Returns:
- Whether the current thread is involved in processing updates for this UpdateGraph
-
serialTableOperationsSafe
boolean serialTableOperationsSafe()Test if engine code executing on the current thread should assume safety for serial table operations. Operations annotated as concurrent are always safe.- Returns:
- Whether code on this thread should assume serial table operation safety
- See Also:
-
setSerialTableOperationsSafe
boolean setSerialTableOperationsSafe(boolean newValue) User or engine code that makes its own determination about the safety of initiating serial table operations on the current thread may use this method to override default behavior. The previous value should be restored immediately after use, typically with the following pattern:boolean oldValue = assumeSerialTableOperations(true); try { // ... safe table operations here } finally { assumeSerialTableOperations(oldValue); }
- Parameters:
newValue
- the new value- Returns:
- the old value
- See Also:
-
allowSerialTableOperations
default <RETURN_TYPE> RETURN_TYPE allowSerialTableOperations(@NotNull @NotNull Supplier<RETURN_TYPE> operation) User or engine code that is certain a particular table operation is safe to execute with respect to this UpdateGraph may use this method to follow the prescribed pattern for declaring safety and reinstating the priority safety parameters.- Type Parameters:
RETURN_TYPE
- The return type of the operation- Parameters:
operation
- The safe operation to perform- Returns:
- The result of
operation
- See Also:
-
allowSerialTableOperations
default <RETURN_TYPE,EXCEPTION_TYPE extends Exception> RETURN_TYPE allowSerialTableOperations(@NotNull @NotNull ThrowingSupplier<RETURN_TYPE, EXCEPTION_TYPE> operation) throws EXCEPTION_TYPEUser or engine code that is certain a particular table operation is safe to execute with respect to this UpdateGraph may use this method to follow the prescribed pattern for declaring safety and reinstating the priority safety parameters.- Type Parameters:
RETURN_TYPE
- The return type of the operationEXCEPTION_TYPE
- The exception type the operation might throw- Parameters:
operation
- The safe operation to perform- Returns:
- The result of
operation
- Throws:
EXCEPTION_TYPE
- ifoperation
throws- See Also:
-
checkInitiateSerialTableOperation
default void checkInitiateSerialTableOperation()If we initiate a serial (not annotated as concurrent) table operation that should update using this UpdateGraph without holding the appropriate lock, then we are likely committing a grievous error, but one that will only occasionally result in us getting the wrong answer or if we are lucky an assertion. This method is called from various table operations that should not be established without locking their UpdateGraph.Threads that process this UpdateGraph's updates are assumed to be safe; if dependencies are tracked correctly, these threads will only initiate table operations when they can proceed.
User or engine code may bypass this check using
setSerialTableOperationsSafe(boolean)
or the related wrapper methods. -
stop
void stop()Attempt to stop this update graph, and cease processing further notifications. -
supportsRefreshing
boolean supportsRefreshing()- Returns:
- Whether this UpdateGraph has a mechanism that supports refreshing
-
requestRefresh
void requestRefresh()Request that this UpdateGraph process any pending updates as soon as practicable. Updates "hurried" in this way are otherwise processed as normal.- Specified by:
requestRefresh
in interfaceUpdateSourceRegistrar
-
requestSignal
Request that aCondition
derived from this UpdateGraph'sexclusiveLock()
besignalled
in a safe manner. This may take place asynchronously.- Parameters:
exclusiveLockCondition
- The condition to signal
-