Interface DataNodeSession
- All Known Implementing Classes:
DataCollectorDelegate.NodeSessionDelegate,DataCollectorFactory.AbstractDataCollector.AbstractNodeSession,DataCollectorFactory.AbstractDataCollector.ManualNodeSession,DataCollectorFactory.AbstractDataCollector.StreamingNodeSession,ErroredNodeSession
public interface DataNodeSession
Represents the session for interacting with a data node.
Provides operations for managing changes to data, metadata,
and source as well as managing the lifecycle of the node session.
DataNodeSession implementations are responsible for ensuring proper handling of resources
and state transitions in the life cycle of the node session.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumEnum representing the availability status of the node. -
Method Summary
Modifier and TypeMethodDescriptionbooleanattachObserver(NodeSessionObserver observer) Attaches aNodeSessionObserverto the node session.booleandetachObserver(NodeSessionObserver observer) Detaches aNodeSessionObserverfrom the node session.Gets the current availability status of the node.processDataChange(DataPoint<?> dataPoint) Processes a data change for the node.processMetadataChange(MetadataPoint metadata) Processes a metadata change for the node.processSourceChange(SourceChangePoint sourceChange) Processes a change in the source configuration or state for the node.voidrelease()Closes the session, releasing any resources associated with it.reset()Resets the current session for the node to its initial state.Retires the node, indicating no further data changes are expected.
-
Method Details
-
getAvailabilityStatus
DataNodeSession.AvailabilityStatus getAvailabilityStatus()Gets the current availability status of the node.- Returns:
- The current
DataNodeSession.AvailabilityStatusof the node.
-
processDataChange
Processes a data change for the node.- Parameters:
dataPoint- The newDataPointcontaining the data change for the node.- Returns:
- A
CompletionStagethat, when completed, provides theQualityCodeof the operation. If the node's availability status isUNSUPPORTED, this will complete withQualityCode.Bad_Unsupported. - Throws:
SourcePathMismatchException- If the source path in the data point doesn't match the path this session represents.
-
processSourceChange
Processes a change in the source configuration or state for the node.- Parameters:
sourceChange- TheSourceChangePointrepresenting the source change to process.- Returns:
- A
CompletionStagethat, when completed, provides theQualityCodeof the operation. If the node's availability status isUNSUPPORTED, this will complete withQualityCode.Bad_Unsupported. - Throws:
SourcePathMismatchException- If the old source path in the source change doesn't match the path this session represents.
-
retireNode
CompletionStage<QualityCode> retireNode()Retires the node, indicating no further data changes are expected. After calling this method, it is expected thatrelease()will be called subsequently to properly clean up resources.- Returns:
- A
CompletionStagethat, when completed, provides theQualityCodeof the operation. If the node's availability status isUNSUPPORTED, this will complete withQualityCode.Bad_Unsupported. - See Also:
-
processMetadataChange
Processes a metadata change for the node.- Parameters:
metadata- TheMetadataPointcontaining the metadata change to process.- Returns:
- A
CompletionStagethat, when completed, provides theQualityCodeof the operation. If the node's availability status isUNSUPPORTED, this will complete withQualityCode.Bad_Unsupported. - Throws:
SourcePathMismatchException- If the source path in the metadata point doesn't match the path this session represents.
-
reset
CompletionStage<QualityCode> reset()Resets the current session for the node to its initial state. This operation may involve clearing any cached data.- Returns:
- A
CompletionStagethat, when completed, provides theQualityCodeindicating the result of the reset operation. If the node's availability status isUNSUPPORTED, this will complete withQualityCode.Bad_Unsupported.
-
release
void release()Closes the session, releasing any resources associated with it.This method ensures that any resources allocated during the session's lifecycle are properly released. It should be called after
retireNode()to complete the cleanup process and prevent resource leaks. -
attachObserver
Attaches aNodeSessionObserverto the node session. This allows the observer to receive updates about the session's state and events.- Parameters:
observer- TheNodeSessionObserverto attach.- Returns:
trueif the observer was successfully attached,falseif already attached or if attachment failed.
-
detachObserver
Detaches aNodeSessionObserverfrom the node session. This stops the observer from receiving further updates about the session's state and events.- Parameters:
observer- TheNodeSessionObserverto detach.- Returns:
trueif the observer was successfully detached,falseif not attached or if detachment failed.
-