deputy abstract method
FutureOr<TissueQueue<E> >
deputy({
- covariant DeputyContext context = DeputyContext.system,
- covariant TestTissue<
dynamic, Tissue> testRule = TestTissue.allowAll, - EphemeralPolicy<
Cell> ? ephemeralPolicy, - 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
testRuleis 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()returnsthis.
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,
});