Expand description
Supervised asynchronous resources with automatic recovery.
Implement Lifecycle and expose a typed client wrapper around Supervisor.
Operations run once by default; retries require explicit per-operation opt-in.
Lifecycle futures must be cancellation-safe.
Macros§
- managed_
client - Generate a typed proxy with ordinary async client methods returning owned results.
Methods must return the lifecycle error type. Borrowed/streaming results need a manual wrapper.
Client::new(supervisor)selects direct supervision for a concurrency-safe resource;from_supervisoris an alias. This is the default backend. With thepoolfeature,Client::from_pool(pool)selects exclusive dispatch with typeClient<ManagedResourceProxy<Hooks>>. Both expose the same generated methods and configuration access throughmanaged. Direct calls are caller-owned and do not promise the pool’s independent shutdown drain. Seecrate::SupervisedResourceProxyfor cancellation semantics.
Structs§
- Bounded
Fifo Queue - FIFO queue with a fixed admission limit. Rejected items are dropped.
- Config
- Config
Error - A framework configuration field and the rule it violates. Contains no secrets.
- Disconnect
OnDrop - Signal connection loss before releasing ownership of an incomplete scope.
- Fifo
Queue - First-in, first-out operation queue. Priority metadata does not affect ordering.
- Generation
- Opaque identity for one resource generation, independent of numeric counters.
- Generation
Mismatch - The supplied token belongs to a different resource generation.
- Generation
Value - A value accessible only with its originating generation token.
- Managed
Resource Proxy - Stable proxy backing typed client wrappers. Attributes are replayed through named setters.
- Pool
- Demand-grown pool of independently supervised resources. Minimum counts all entries. Start inside a Tokio runtime. Lower priority numbers run first when priority_queue is enabled.
- Pool
Config - Priority
Queue - Heap queue. Queued operations sort lower priorities first and FIFO on ties.
- Queued
Operation - Opaque queued work with scheduling metadata. Only the pool can execute it.
- Resource
Handle - A specific resource generation. Old handles do not silently become new resources.
- Resource
Lease - Exclusive reservation of a supervisor; reconnection does not end the lease.
- Resource
Status - Retire
OnDrop - Retire a resource slot when a scope ends before the adapter confirms completion.
- Retry
Policy - Bounds for an explicitly retryable operation. The caller must ensure replay is safe.
- Supervised
Resource Proxy - Stable proxy for a single resource supporting concurrent operations.
- Supervisor
- Cloneable client-facing handle. Start inside a Tokio runtime.
Dropping the last supervisor requests shutdown;
stop().awaitwaits for teardown.
Enums§
- Error
- Lifecycle
Failure Policy - Scheduling decision for an initialization or disconnect-watch error.
- Operation
Failure Policy - Recovery decision for an operation error; independent of replay permission.
- Queue
Error - Rejection from a custom queue, including bounded queues at capacity.
- Resource
State
Traits§
- Lifecycle
- Protocol-specific lifecycle hooks. Resources usually contain their own interior mutability.
- Managed
Client Backend - Execution backend for methods generated by
crate::managed_client!. Implementations select whether calls require exclusive pooled access or can execute concurrently. Dispatch is static and does not box operation futures. - Operation
Queue - Synchronous queue used under the pool’s internal lock.