summaryrefslogtreecommitdiff
path: root/core/ninep/pane.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/ninep/pane.zig')
-rw-r--r--core/ninep/pane.zig22
1 files changed, 22 insertions, 0 deletions
diff --git a/core/ninep/pane.zig b/core/ninep/pane.zig
index 1d514a3c..d47b637b 100644
--- a/core/ninep/pane.zig
+++ b/core/ninep/pane.zig
@@ -30,6 +30,28 @@ const Node = tree.Node;
/// Filesystem state a pane carries beside its editor state.
pub const State = struct {
+ /// What a step reads of it is digested and dumped (fs.Namespace); the
+ /// readers' records and the server's say of them are the session's.
+ pub const replica = .{ .authority = .{ "readers", "event_reader", "events", "tag_snap", "pty_reader", "pty_out", "winsize", "unannounced" } };
+
+ /// Its digest (core/walk.zig): nothing for a pane no script has set
+ /// anything of (most of them, at every unit a replica confirms); the
+ /// rest's fields as one run of bytes, not a hash's call a field.
+ pub fn digest(st: *const State, h: *pardes.walk.Hasher) void {
+ const untouched: State = .{};
+ var touched = false;
+ inline for (comptime pardes.walk.fieldNames(State)) |name| touched = touched or !std.meta.eql(@field(st, name), @field(untouched, name));
+ if (!touched) return;
+ var buf: [256]u8 = undefined;
+ var w: std.Io.Writer = .fixed(&buf);
+ // Longer than the room (a chord's text): field by field.
+ if (encoded(st, &w)) |_| h.update(w.buffered()) else |_| inline for (comptime pardes.walk.fieldNames(State)) |name| pardes.walk.hash(@FieldType(State, name), &@field(st, name), h);
+ }
+
+ fn encoded(st: *const State, w: *std.Io.Writer) std.Io.Writer.Error!void {
+ inline for (comptime pardes.walk.fieldNames(State)) |name| try pardes.walk.encode(@FieldType(State, name), &@field(st, name), w);
+ }
+
/// The range `data` and `xdata` read and write through. acme clears it
/// when the first client opens `addr` (editors/acme/xfid.c:105-108),
/// which suits a client that holds the fid open; a shell cannot, and