summaryrefslogtreecommitdiff
path: root/src/wire.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/wire.zig')
-rw-r--r--src/wire.zig8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/wire.zig b/src/wire.zig
index 9773d222..864c2fd8 100644
--- a/src/wire.zig
+++ b/src/wire.zig
@@ -183,6 +183,10 @@ pub const ServerTag = enum(u8) {
/// A piece of a far client's stream from here on, zstd-compressed: the
/// messages in it are framed as these are. Opaque here.
zstd = 0x09,
+ /// A piece of a record's bytes by hash (tape.zig `Big`), before the
+ /// unit naming it: the hash, the whole's length and this piece's place
+ /// (u64le each), then at most 1 MiB of it (src/replica.zig).
+ blob = 0x0a,
};
pub const ServerMsg = union(ServerTag) {
@@ -199,6 +203,7 @@ pub const ServerMsg = union(ServerTag) {
check: u64,
blobs: []const u8,
zstd: []const u8,
+ blob: []const u8,
};
/// A message's header, for a payload sent on its own (a unit, a dump's
@@ -233,6 +238,7 @@ pub fn decodeServer(tag: u8, payload: []const u8) Error!ServerMsg {
.check => .{ .check = try r.takeInt(u64, .little) },
.blobs => return .{ .blobs = payload },
.zstd => return .{ .zstd = payload },
+ .blob => return .{ .blob = payload },
};
try end(&r);
return msg;
@@ -255,7 +261,7 @@ pub fn encodeServer(out: []u8, msg: ServerMsg) Error![]const u8 {
},
.refused => |words| try putSlice16(&w, words),
.pong => |v| try w.writeInt(u64, v, .little),
- .dump, .unit, .screen, .blobs, .zstd => |bytes| try w.writeAll(bytes),
+ .dump, .unit, .screen, .blobs, .zstd, .blob => |bytes| try w.writeAll(bytes),
.check => |v| try w.writeInt(u64, v, .little),
}
try finishMessage(&w, at);