refactor: remove proxy_id concept entirely

Not really needed and just adds extra fluff.
This commit is contained in:
CJ van den Berg 2026-03-10 15:25:20 +01:00
parent bc45042063
commit 650beac975
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
4 changed files with 6 additions and 37 deletions

View file

@ -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),
}
}

View file

@ -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 } };