Package com.seeq.link.sdk.interfaces
Interface AddOnCalculationDatasourceConnection
public interface AddOnCalculationDatasourceConnection
Implemented by connections that offers external calculation services
-
Method Summary
Modifier and TypeMethodDescriptionReturns a new instance of a validator that is used to validate the script.getCalculatedResults
(String script, Stream<List<Sample>> alignedSignalsStream, AddOnCalcSignalDataType[] signalDataTypes, int numberOfSignals, int numberOfSamplesPerSignal, Long windowSize) Delegates calculation to the external script and obtain the result back from it.void
Marks (into the connection) the script as breaking no contract.boolean
In case a script has been changed we need to check again if the script breaks the contract.void
Validates the calculation request, checking that all optional parameter is set according to the script input mode
-
Method Details
-
getCalculatedResults
Stream<Sample> getCalculatedResults(String script, Stream<List<Sample>> alignedSignalsStream, AddOnCalcSignalDataType[] signalDataTypes, int numberOfSignals, int numberOfSamplesPerSignal, @Nullable Long windowSize) Delegates calculation to the external script and obtain the result back from it.- Parameters:
script
- Name of the scriptalignedSignalsStream
- A stream of aligned samples given to the script for computing the result. Note: this parameter uses the same structure as AlignedIterator.signalDataTypes
- Data type for value of samples of each signal provided in the inputnumberOfSignals
- Number of signals the input stream containsnumberOfSamplesPerSignal
- Number of samples per signalwindowSize
- Number of sample in a window, null means the calculation does not use a window- Returns:
- A stream used to retrieve the samples. A stream is used so the connection author can avoid loading all samples into memory, if the underlying datasource interface allows it.
-
validateRequest
Validates the calculation request, checking that all optional parameter is set according to the script input mode- Parameters:
request
- request to validate
-
needsValidation
boolean needsValidation()In case a script has been changed we need to check again if the script breaks the contract. Contract break detection is done only one time.- Returns:
- true if the script needs to be rechecked for breaking the established contract
-
createValidator
AddOnCalculationValidator createValidator()Returns a new instance of a validator that is used to validate the script.- Returns:
- a new validator
-
markAsValid
void markAsValid()Marks (into the connection) the script as breaking no contract. Once marked the detection is suppressed untilneedsValidation()
returns again true. This should be reset to true when the script is changed. -
getValidationLock
Lock getValidationLock()- Returns:
- a lock which is used to ensure that the same script is not validated more than once even if more requests are triggered at the same time
-