Struct rtlola_interpreter::queued::QueuedMonitor
source · pub struct QueuedMonitor<Source, SourceTime, Verdict = Incremental, VerdictTime = RelativeFloat>where
Source: Input,
SourceTime: TimeRepresentation,
Verdict: VerdictRepresentation,
VerdictTime: OutputTimeRepresentation + 'static,{ /* private fields */ }
Expand description
The QueuedMonitor is a threaded version of the Api allowing deadlines to be evaluated immediately.
The QueuedMonitor accepts new events and computes streams. It can compute streams based on new events through accept_event once the start function was invoked. Timed streams are evaluated automatically at their deadline. The resulting verdicts of events and deadlines are returned through a Receiver which can be obtained through output_queue. Note that the start function has to be invoked before any event can be evaluated. Finally, a calling end will block until all events have been evaluated.
The generic argument Source
implements the Input trait describing the input source of the API.
The generic argument SourceTime
implements the TimeRepresentation trait defining the input time format.
The generic argument Verdict
implements the VerdictRepresentation trait describing the output format of the API that is by default Incremental.
The generic argument VerdictTime
implements the TimeRepresentation trait defining the output time format. It defaults to RelativeFloat
Implementations§
source§impl<Source, SourceTime, Verdict, VerdictTime> QueuedMonitor<Source, SourceTime, Verdict, VerdictTime>where
Source: Input + 'static,
SourceTime: TimeRepresentation,
Verdict: VerdictRepresentation,
VerdictTime: OutputTimeRepresentation,
impl<Source, SourceTime, Verdict, VerdictTime> QueuedMonitor<Source, SourceTime, Verdict, VerdictTime>where
Source: Input + 'static,
SourceTime: TimeRepresentation,
Verdict: VerdictRepresentation,
VerdictTime: OutputTimeRepresentation,
sourcepub fn bounded_setup(
config: Config<SourceTime, VerdictTime>,
setup_data: Source::CreationData,
input_queue_bound: QueueLength,
output_queue_bound: QueueLength
) -> QueuedMonitor<Source, SourceTime, Verdict, VerdictTime>
pub fn bounded_setup(
config: Config<SourceTime, VerdictTime>,
setup_data: Source::CreationData,
input_queue_bound: QueueLength,
output_queue_bound: QueueLength
) -> QueuedMonitor<Source, SourceTime, Verdict, VerdictTime>
setup the api, while providing bounds for the queues.
sourcepub fn setup(
config: Config<SourceTime, VerdictTime>,
setup_data: Source::CreationData
) -> QueuedMonitor<Source, SourceTime, Verdict, VerdictTime>
pub fn setup(
config: Config<SourceTime, VerdictTime>,
setup_data: Source::CreationData
) -> QueuedMonitor<Source, SourceTime, Verdict, VerdictTime>
setup the api
Examples found in repository?
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
pub fn queued_monitor_with_data(
self,
data: Source::CreationData,
) -> QueuedMonitor<Source, SourceTime, Verdict, VerdictTime> {
QueuedMonitor::setup(self.config, data)
}
#[cfg(feature = "queued-api")]
/// Transforms the configuration into a [QueuedMonitor]
pub fn queued_monitor(self) -> QueuedMonitor<Source, SourceTime, Verdict, VerdictTime>
where
Source: Input<CreationData = ()>,
{
QueuedMonitor::setup(self.config, ())
}
sourcepub fn start(&mut self) -> Result<(), QueueError>
pub fn start(&mut self) -> Result<(), QueueError>
Starts the evaluation process. This method has to be called before any event is accepted.
sourcepub fn output_queue(&self) -> Receiver<QueuedVerdict<Verdict, VerdictTime>>
pub fn output_queue(&self) -> Receiver<QueuedVerdict<Verdict, VerdictTime>>
This method returns the queue through which the verdicts can be received.
sourcepub fn accept_event(
&mut self,
ev: Source::Record,
ts: SourceTime::InnerTime
) -> Result<(), QueueError>
pub fn accept_event(
&mut self,
ev: Source::Record,
ts: SourceTime::InnerTime
) -> Result<(), QueueError>
Schedules a new event for evaluation. The verdict can be received through the Queue return by the QueuedMonitor::output_queue.
sourcepub fn end(self) -> Result<(), QueueError>
pub fn end(self) -> Result<(), QueueError>
Ends the evaluation process and blocks until all events are processed.
sourcepub fn ir(&self) -> &RtLolaMir
pub fn ir(&self) -> &RtLolaMir
Returns the underlying representation of the specification as an RtLolaMir
sourcepub fn name_for_input(&self, id: InputReference) -> &str
pub fn name_for_input(&self, id: InputReference) -> &str
Get the name of an input stream based on its InputReference.
The reference is valid for the lifetime of the monitor.
sourcepub fn name_for_output(&self, id: OutputReference) -> &str
pub fn name_for_output(&self, id: OutputReference) -> &str
Get the name of an output stream based on its OutputReference.
The reference is valid for the lifetime of the monitor.
sourcepub fn trigger_message(&self, id: usize) -> &str
pub fn trigger_message(&self, id: usize) -> &str
Get the message of a trigger based on its index.
The reference is valid for the lifetime of the monitor.
sourcepub fn trigger_stream_index(&self, id: usize) -> usize
pub fn trigger_stream_index(&self, id: usize) -> usize
Get the OutputReference of a trigger based on its index.
sourcepub fn number_of_input_streams(&self) -> usize
pub fn number_of_input_streams(&self) -> usize
Get the number of input streams.
sourcepub fn number_of_output_streams(&self) -> usize
pub fn number_of_output_streams(&self) -> usize
Get the number of output streams (this includes one output stream for each trigger).
sourcepub fn number_of_triggers(&self) -> usize
pub fn number_of_triggers(&self) -> usize
Get the number of triggers.
sourcepub fn type_of_input(&self, id: InputReference) -> &Type
pub fn type_of_input(&self, id: InputReference) -> &Type
Get the type of an input stream based on its InputReference.
The reference is valid for the lifetime of the monitor.
sourcepub fn type_of_output(&self, id: OutputReference) -> &Type
pub fn type_of_output(&self, id: OutputReference) -> &Type
Get the type of an output stream based on its OutputReference.
The reference is valid for the lifetime of the monitor.
sourcepub fn extend_rate_of_output(&self, id: OutputReference) -> Option<Duration>
pub fn extend_rate_of_output(&self, id: OutputReference) -> Option<Duration>
Get the extend rate of an output stream based on its OutputReference.
The reference is valid for the lifetime of the monitor.