╭ changed ────╮ │src/event.zig│ ╰─────────────╯ ╭────────────────────────────────────────────────────────────────────╮ │236 server, │ │237 }; │ │238 │ │239 +// where events are written, with the context only a server has│ │240 +pub const Host = union(HostKind) { │ │241 + local, │ │242 + server: Server, │ │243 + │ │244 + pub const Server = struct { │ │245 + users_dir: []const u8, │ │246 + }; │ │247 +}; │ │248 + │ │249 // who a commit is attributed to │ │250 pub const CommitAuthor = struct { │ │251 name: []const u8, │ ╰────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────╮ │360 │ │361 // remove an event by emitting a null payload │ │362 pub fn remove( │ │353 - host_kind: HostKind, │ │363 + host: Host, │ │364 comptime role: RepoRole, │ │365 comptime repo_kind: rp.RepoKind, │ │366 comptime repo_opts: rp.RepoOpts(repo_kind),│ ╰────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ │398 .patchrev => .{ .patchrev = null }, │ │399 .patch => .{ .patch = null }, │ │400 }; │ │391 - try consume(host_kind, role, repo_kind, repo_opts, io, allocator, repo, events_ref, &.{.{│ │401 + try consume(host, role, repo_kind, repo_opts, io, allocator, repo, events_ref, &.{.{ │ │402 .id = std.fmt.bytesToHex(id.*, .lower), │ │403 .timestamp = @intCast(std.Io.Timestamp.now(io, .real).toSeconds()), │ │404 .author = author, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────╮ │441 // commits and the consume run in one transaction, which also saves the│ │442 // mergeability of the patches the events touched. │ │443 pub fn consume( │ │434 - host_kind: HostKind, │ │444 + host: Host, │ │445 comptime role: RepoRole, │ │446 comptime repo_kind: rp.RepoKind, │ │447 comptime repo_opts: rp.RepoOpts(repo_kind), │ ╰────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────╮ │495 const State = rp.Repo(.xit, repo_opts).State; │ │496 var checks: pch.MergeCheckInputs(repo_opts) = .{}; │ │497 defer checks.deinit(io, allocator); │ │488 - if (role == .repo and host_kind == .server) { │ │489 - checks.prepare(io, allocator, repo, events) catch |err| { │ │498 + if (role == .repo and host == .server) { │ │499 + checks.prepare(io, allocator, repo, host.server.users_dir, events) catch |err| {│ │500 std.log.warn("failed to prepare mergeability: {s}", .{@errorName(err)}); │ │501 }; │ │502 } │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │542 │ │543 // consuming an existing ref does not provide the set of changed patches │ │544 // explicit patch writes already saved their checks in the event transaction │ │535 - if (role == .repo and repo_kind == .xit and host_kind == .server and events.len == 0) { │ │536 - pch.refreshOpenMergeability(repo_opts, io, allocator, repo, null, null); │ │545 + if (role == .repo and repo_kind == .xit and host == .server and events.len == 0) { │ │546 + pch.refreshOpenMergeability(repo_opts, io, allocator, repo, host.server.users_dir, null, null);│ │547 } │ │548 } │ │549 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1777 io.random(&id_bytes); │ │1778 const event_id_hex = std.fmt.bytesToHex(id_bytes, .lower); │ │1779 │ │1770 - try consume(.server, .user, .xit, user_repo_opts, io, allocator, &user_repo, events_ref, &[_]EventWithId{.{ │ │1780 + try consume(.{ .server = .{ .users_dir = users_dir } }, .user, .xit, user_repo_opts, io, allocator, &user_repo, events_ref, &[_]EventWithId{.{│ │1781 .id = event_id_hex, │ │1782 .timestamp = @intCast(std.Io.Timestamp.now(io, .real).toSeconds()), │ │1783 .author = .{ .name = owner.event.name, .email = owner.event.email }, │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ───────────────╮ │src/event/Attachment.zig│ ╰────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────╮ │115 // attach `blob` to a parent event and return the event id. `repo` must be│ │116 // writable. │ │117 pub fn create( │ │118 - host_kind: evt.HostKind, │ │118 + host: evt.Host, │ │119 comptime repo_kind: rp.RepoKind, │ │120 comptime repo_opts: rp.RepoOpts(repo_kind), │ │121 io: std.Io, │ ╰───────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │146 var id_bytes: [evt.event_id_size]u8 = undefined; │ │147 io.random(&id_bytes); │ │148 const event_id = std.fmt.bytesToHex(id_bytes, .lower); │ │149 - try evt.consume(host_kind, .repo, repo_kind, repo_opts, io, allocator, repo, evt.events_ref, &.{.{│ │149 + try evt.consume(host, .repo, repo_kind, repo_opts, io, allocator, repo, evt.events_ref, &.{.{ │ │150 .id = event_id, │ │151 .timestamp = @intCast(std.Io.Timestamp.now(io, .real).toSeconds()), │ │152 .author = author, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ────────────╮ │src/event/Comment.zig│ ╰─────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────╮ │ 99 │ │100 // create a comment and return its event id. `repo` must be writable.│ │101 pub fn create( │ │102 - host_kind: evt.HostKind, │ │102 + host: evt.Host, │ │103 comptime repo_kind: rp.RepoKind, │ │104 comptime repo_opts: rp.RepoOpts(repo_kind), │ │105 io: std.Io, │ ╰──────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯