swactor/crates/data-plane/src/ids.rs
Zachery Aaron Shores-Chmielewski cc6a582102 Move all edge logic into data-plane; reduce iroh-driver to a byte-transport port
Duty mixing between iroh-driver and data-plane is resolved: the transport
crate now owns only byte pumping, and the data-plane owns every edge
semantic.

data-plane:
- ids.rs: single EdgeId/RingId/StreamId/NodeId/RunId/LeaseRequestId/
  ActorAddress definitions; arena, edge_lifecycle, and ring re-export them
  (previously duplicated per module)
- edge_wire.rs: the whole transport contract — WireEvent, EdgeWriter, and
  the EdgeTransport port (associated Writer/PeerAddr types)
- edge_runtime.rs: EdgeRuntime composition engine absorbing iroh-driver's
  driver_pumps bookkeeping, the EdgeEstablisher lifecycle drive, arena
  leasing, ingress stream buffering with object-record parsing, and ring
  writes; effects go through a WorkerPort trait; progress surfaces as
  structured Observations the application maps to telemetry/agent messages
- delete superseded test-only layers: actor.rs (DataPlaneNodeActor),
  edge_actor.rs, ingress.rs, egress.rs and their guarantee tests
- fold ObjectIdAllocator into object_record (now edge-free, starts at 1)

iroh-driver:
- edge_transport speaks pure data_plane::edge_wire vocabulary; EdgeSendHandle
  implements EdgeWriter; IrohDriver implements EdgeTransport (PeerAddr =
  EndpointAddr) — the entire edge surface is open_writer + drain_events
- delete driver_pumps.rs; new dependency on data-plane (no cycle)
- IROH_DRIVER_SPEC §5 updated for the new module set and edge boundary

myelin:
- WorkerEdgeRuntime shrinks from ~830 lines of hand glue to an EdgeRuntime
  holder plus a tinygrad WorkerPort impl and observation reporting; the
  driver-event/edge-event translation layers and newtype re-wrapping are
  gone
- orchestration/app.rs and job edge drains consume WireEvent

Tests: data-plane 31 (5 new EdgeRuntime contract tests), iroh-driver 13,
myelin 65 — all green.
2026-08-16 21:49:45 +04:00

29 lines
1.1 KiB
Rust

//! Single definitions of the data-plane identifier newtypes.
//!
//! Every module — and the iroh-driver edge transport — re-exports these, so
//! edge, ring, arena, and wire code share one vocabulary instead of defining
//! structurally identical `u64` newtypes and re-wrapping them at every crate
//! boundary.
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct RunId(pub u64);
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct NodeId(pub u64);
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct EdgeId(pub u64);
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct RingId(pub u64);
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct StreamId(pub u64);
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct LeaseRequestId(pub u64);
/// Data-plane-local actor address for edge endpoints. Distinct from the
/// swactor runtime's actor address; the application maps between them.
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ActorAddress(pub u64);