|
oc_connect
|
Classes | |
| class | CommsMigrationError |
| class | MigratedFile |
| class | MigrationReport |
| class | CommsBus |
Functions | |
| str | _encode (int value, int length) |
| str | new_ulid (datetime now, *, bytes|None entropy=None) |
| str | utc_stamp (datetime now) |
| str | message_filename (datetime now, str source, str ulid) |
| str | content_digest (bytes payload) |
| None | _atomic_write (Path destination, bytes payload) |
| int | _count_records (str name, bytes payload) |
| tuple[Path,...] | _message_paths (Path directory) |
Variables | |
| str | _CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ" |
| str | OUTBOX_FILENAME = "outbox.json" |
| str | AUDIT_FILENAME = "audit.jsonl" |
The comms bus: one workspace-anchored root with lane-separated storage.
Proposal V1 §3, verbatim layout::
oc_chat/.option_c/comms/
outbound/ # the plan-219 durable outbox, relocated here
inbound/
telegram/ # operator replies, one JSON file per message
lanes/
worker-reports/ # created by plan 231, not here
audit/ # hash-only audit trail across all lanes
Lane separation is structural, not advisory: the directories exist, each
consumer is handed only the directory it may touch, and every stored record
names its lane, direction and risk class (§9's binding rule).
The plan-219 state moves in through :meth:`CommsBus.migrate_from`, which is a
*verified* move: hash the source, write the destination, re-read and re-hash the
destination, and only then unlink the source. A mismatch aborts with the source
still in place, so a failed migration loses nothing.
Dependencies
------------
- oc_connect.workspace (comms_root - the workspace-anchored root of the bus)
- oc_diagnostics (_dbg structured logger)
|
protected |
|
protected |
|
protected |
|
protected |
| str oc_connect.comms.content_digest | ( | bytes | payload | ) |
| str oc_connect.comms.message_filename | ( | datetime | now, |
| str | source, | ||
| str | ulid ) |
| str oc_connect.comms.new_ulid | ( | datetime | now, |
| * | , | ||
| bytes | None | entropy = None ) |
Return a 26-character ULID: 48 bits of time, 80 bits of randomness. Time-first encoding means lexical order is arrival order, which is what makes the flood bound's oldest-first rule a plain directory sort. *entropy* exists so tests can pin the random half; production leaves it ``None`` and draws from :mod:`secrets`.
Definition at line 62 of file comms.py.
| str oc_connect.comms.utc_stamp | ( | datetime | now | ) |
|
protected |