iei-protocol
iei-protocol is a dependency-free Rust state machine for the principles of
sending: identify the message, bound its lifetime, send it, wait for an
acknowledgement, retry deliberately, and stop decisively.
It does not perform network I/O. An application asks the state machine what to do, performs transport-specific work, and records the resulting event.
Guarantees
- every envelope has a non-empty stable identifier and an expiry time;
- acknowledgement timeout and retry count are finite and explicit;
- time cannot move backwards within a delivery;
- retries stop at the configured attempt limit;
- expiry is terminal unless delivery was already acknowledged;
- duplicate acknowledgements are idempotent.
Example
use ;
let envelope = new?;
let policy = new?;
let mut delivery = new;
assert_eq!;
delivery.record_sent?;
assert_eq!;
assert_eq!;
delivery.record_sent?;
assert_eq!;
assert_eq!;
# Ok::
Run the bundled example:
cargo run --example delivery
Delivery semantics
iei-protocol models control flow, not exactly-once transport. A send attempt
may reach its receiver even if its acknowledgement is lost. Use the envelope
identifier as an idempotency key at the receiver when repeated effects must be
prevented.
License
MIT