diff --git a/docs/remoting-design.md b/docs/remoting-design.md index 1cc7b32..fe68362 100644 --- a/docs/remoting-design.md +++ b/docs/remoting-design.md @@ -171,14 +171,10 @@ The defined message types are: | `"send_named"` | both | `from_id: u64`, `to_name: text`, `payload: cbor` | Deliver to a well-known actor by name | | `"link"` | both | `local_id: u64`, `remote_id: u64` | Establish a link between a local actor and a remote actor | | `"exit"` | both | `id: u64`, `reason: text` | Remote actor `id` has exited with reason | -| `"proxy_id"` | both | `name: text`, `id: u64` | Response to `send_named`: here is the opaque ID for this named actor | | `"transport_error"` | both | `reason: text` | Signal that the sending side is tearing down | The `from_id` and `to_id` fields are opaque 64-bit integers assigned by the -_home system_ of the actor. ID `0` is reserved and invalid. Named lookups -(`send_named`) trigger the remote side to create or locate a proxy for the -named actor and reply with its assigned ID via `proxy_id`, after which the -sender can use the ID directly. +_home system_ of the actor. ID `0` is reserved and invalid. --- @@ -288,15 +284,9 @@ const Proxy = struct { ### Lifecycle -A proxy is created by the endpoint in two situations: - -1. **Inbound message with unknown `from_id`**: The endpoint receives a wire - message from a remote actor ID it has not seen before. It spawns a proxy - for that ID and records it in the proxy table before delivering the message - locally. -2. **Explicit lookup response (`proxy_id`)**: After a `send_named` - exchange, the endpoint now knows the remote ID for a named actor and - creates a proxy for it. +A proxy is created by the endpoint when it receives a wire message from a +remote actor ID it has not seen before. It spawns a proxy for that ID and +records it in the proxy table before delivering the message locally. A proxy is destroyed when: @@ -424,6 +414,3 @@ unique, which is sufficient for the 1:1 child process model. - **Backpressure**: The current model has no backpressure - a fast sender can overwhelm a slow transport. This is acceptable for the initial implementation but will need attention under load. -- **Named actor re-registration**: If a well-known actor exits and is - restarted under the same name, proxies on the remote side will hold stale - IDs. A generation counter or re-lookup mechanism will be needed. diff --git a/src/remote/endpoint.zig b/src/remote/endpoint.zig index 3d62461..4bcb450 100644 --- a/src/remote/endpoint.zig +++ b/src/remote/endpoint.zig @@ -165,7 +165,7 @@ const Endpoint = struct { if (self.proxies.get(e.id)) |p| p.send(.{ "exit", e.reason }) catch {}; }, - .proxy_id, .link, .transport_error => return tp.exit_error(error.UnexpectedMessage, null), + .link, .transport_error => return tp.exit_error(error.UnexpectedMessage, null), } } diff --git a/src/remote/protocol.zig b/src/remote/protocol.zig index bea8415..a9b2af8 100644 --- a/src/remote/protocol.zig +++ b/src/remote/protocol.zig @@ -46,14 +46,6 @@ pub fn encode_exit(writer: *std.Io.Writer, id: u64, reason: []const u8) !void { try cbor.writeValue(writer, reason); } -/// Encode a `proxy_id` wire message into writer. -pub fn encode_proxy_id(writer: *std.Io.Writer, name: []const u8, id: u64) !void { - try cbor.writeArrayHeader(writer, 3); - try cbor.writeValue(writer, "proxy_id"); - try cbor.writeValue(writer, name); - try cbor.writeValue(writer, id); -} - /// Encode a `transport_error` wire message into writer. pub fn encode_transport_error(writer: *std.Io.Writer, reason: []const u8) !void { try cbor.writeArrayHeader(writer, 2); @@ -66,7 +58,6 @@ pub const WireMessage = union(enum) { send_named: SendNamed, link: Link, exit: Exit, - proxy_id: ProxyId, transport_error: TransportError, pub const Send = struct { @@ -91,11 +82,6 @@ pub const WireMessage = union(enum) { reason: []const u8, }; - pub const ProxyId = struct { - name: []const u8, - id: u64, - }; - pub const TransportError = struct { reason: []const u8, }; @@ -111,7 +97,6 @@ pub fn decode(frame: []const u8) !WireMessage { var local_id: u64 = 0; var remote_id: u64 = 0; var id: u64 = 0; - var name: []const u8 = ""; var reason: []const u8 = ""; if (try cbor.match(frame, .{ "send", cbor.extract(&from_id), cbor.extract(&to_id), cbor.extract_cbor(&payload) })) @@ -126,9 +111,6 @@ pub fn decode(frame: []const u8) !WireMessage { if (try cbor.match(frame, .{ "exit", cbor.extract(&id), cbor.extract(&reason) })) return .{ .exit = .{ .id = id, .reason = reason } }; - if (try cbor.match(frame, .{ "proxy_id", cbor.extract(&name), cbor.extract(&id) })) - return .{ .proxy_id = .{ .name = name, .id = id } }; - if (try cbor.match(frame, .{ "transport_error", cbor.extract(&reason) })) return .{ .transport_error = .{ .reason = reason } }; diff --git a/test/remote_child_endpoint.zig b/test/remote_child_endpoint.zig index 47d771a..fdb3e8a 100644 --- a/test/remote_child_endpoint.zig +++ b/test/remote_child_endpoint.zig @@ -254,7 +254,7 @@ const StdioEndpoint = struct { else return tp.exit_error(error.UnknownWireId, null); }, - .link, .exit, .proxy_id, .transport_error => return tp.exit_error(error.UnexpectedMessage, null), + .link, .exit, .transport_error => return tp.exit_error(error.UnexpectedMessage, null), } }