deputy abstract method

  1. @override
FutureOr<TissueQueue<E>> deputy({
  1. covariant DeputyContext context = DeputyContext.system,
  2. covariant TestTissue<dynamic, Tissue> testRule = TestTissue.allowAll,
  3. EphemeralPolicy<Cell>? ephemeralPolicy,
  4. Synapses<Pulse, Cell> synapses = Synapses.enabled,
})
override

Creates a delegated view (deputy) of this queue with specialised behavioural, security, and validation logic.

The deputy method is a fundamental implementation of the Deputy Pattern within the double‑ended reactive ecosystem. It allows for the instantiation of a derived TissueQueue that remains physically anchored to the same underlying storage as the original (principal) queue, but operates under a distinct layer of governance, validation rules, and execution context.

When to use

Use this when you need a restricted view of the queue:

  • Read‑only view: queue.deputy(testRule: TestTissue.readOnly)
  • Scoped authority: queue.deputy(context: DeputyContext.delegate(...))
  • Temporary access: queue.deputy(ephemeralPolicy: ...)
  • Bounded sub‑queue: queue.deputy(capacity: 5) (if the nucleus allows)

How it works

  • The deputy shares the same physical storage and lock as the source.
  • The provided testRule is layered on top of the principal's rule (you can only narrow permissions, never widen).
  • The deputy gets its own Synapses registry by default, so it can have its own observers.
  • If all parameters are left at default, deputy() returns this.

Example

final source = TissueQueue<String>();
final readOnly = await source.deputy(testRule: TestTissue.readOnly);
// readOnly.add('A'); // blocked
source.add('A'); // readOnly reflects the change

Implementation

@override
FutureOr<TissueQueue<E>> deputy({
  covariant DeputyContext context = DeputyContext.system,
  covariant TestTissue testRule = TestTissue.allowAll,
  EphemeralPolicy? ephemeralPolicy,
  Synapses synapses = Synapses.enabled,
});