PendingPayloadBuffer constructor

PendingPayloadBuffer({
  1. required void onDrop(
    1. CEPTriggerPayload trigger,
    2. DropReason reason
    ),
  2. bool arrivalOrder = false,
  3. DateTime now()?,
  4. Timer createTimer(
    1. Duration delay,
    2. void callback()
    )?,
})

Creates a buffer. onDrop settles a removed trigger with the CEP.

arrivalOrder flushes oldest first, for known-inline triggers. now and createTimer replace the clock in tests.

Implementation

PendingPayloadBuffer({
  required void Function(CEPTriggerPayload trigger, DropReason reason) onDrop,
  bool arrivalOrder = false,
  DateTime Function()? now,
  Timer Function(Duration delay, void Function() callback)? createTimer,
})  : _onDrop = onDrop,
      _arrivalOrder = arrivalOrder,
      _now = now ?? DateTime.now,
      _createTimer = createTimer ?? Timer.new;