HPPR Replication

© R.A.Sol

Repository replication uses command 🖧EXCHANGE. It synchronizes packets while preserving ACL decisions.

🖧EXCHANGE

🖧EXCHANGE has three phases:

  1. announce
  2. transfer
  3. finalize

Phase 1: Announce

Requester sends up to 1024 LF-separated lines:

NEED <versioned-coord>
HAVE <versioned-coord>

Responder returns FIN or PENDING followed by status lines:

SEND <coord>
DENY <coord>
RECV <coord>
HAVE <coord>

Status meanings:

Phase 2: Transfer

Both peers stream raw packets concurrently in both directions.

Implementations MUST perform bidirectional I/O concurrently. Unidirectional blocking can deadlock the exchange.

Packet boundaries are parsed using Data-Length.

Phase 3: Finalize

Responder reports final per-coordinate results:

FIN
OK <coord>
FAIL <coord> <type> <msg>

ACL Rules in Phase 1

For NEED <coord>:

  1. check read
  2. if readable and exists: SEND
  3. else: DENY

For HAVE <coord>:

  1. check read
  2. if denied: DENY
  3. if allowed and exists: HAVE
  4. if missing, check write
  5. if writable: RECV
  6. else: DENY

Blob-Addressed 🖧EXCHANGE

🖧EXCHANGE also accepts blob hash addressing:

NEED ////B.<hash>.H3
HAVE ////B.<hash>.H3

Rules:

Decision rules:

Transfer still uses full raw blob packets.

🖧STREAM_IN

🖧STREAM_IN ingests live trailer-format Seal segments.

Request:

Response:

After OK, connection enters relay mode and accepts trailer segments.

Per segment:

  1. relay bytes to matching 🖧STREAM_OUT subscribers
  2. detect segment close marker
  3. verify hash and signature
  4. store packet
  5. emit 🖧WATCH event

ACL: write checked per segment at store time.

Disconnect behavior:

No FATAL is injected into relay stream. Subscribers detect truncation via trailer parsing.

Size rule:

Continuity recommendation:

🖧STREAM_OUT

🖧STREAM_OUT subscribes to live trailer bytes by prefix.

Request:

Behavior:

Late joiners receive bytes buffered from current in-flight segment and then continue live.

ACL: read checked at subscription time.

On publisher disconnect, repo closes subscriber sockets. Mid-segment disconnect yields partial trailer data followed by EOF.

Completed segments remain available via 🖧GET and 🖧EXCHANGE.

Relay Chaining

A downstream repo can relay a live stream by:

  1. subscribing upstream with 🖧STREAM_OUT
  2. publishing downstream with 🖧STREAM_IN