╭ changed ─────────╮ │src/event/Repo.zig│ ╰──────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────╮ │ 7 name: []const u8, │ │ 8 description: []const u8, │ │ 9 enable_issue: bool, │ │10 + │ │11 +const Self = @This(); │ │12 │ │13 pub const name_max_len = 32;│ │14 │ ╰────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────╮ │78 } │ │79 } │ │80 │ │81 +// a repo plus its event id (the id is the on-disk repo directory name, so the │ │82 +// caller can locate the working repo under <server>/repos/<hex event id>). │ │83 +pub const RepoWithId = struct { │ │84 + repo: Self, │ │85 + event_id: [evt.event_id_size]u8, │ │86 +}; │ │87 + │ │88 // read a repo by its owner's name and repo name. the owner name is resolved to │ │89 // a user id via name->user-id (the repo index is keyed by "user-id/repo-name"),│ │90 // matching the /repo/username/reponame url. │ ╰────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 95 arena: *std.heap.ArenaAllocator, │ │ 96 owner_name: []const u8, │ │ 97 repo_name: []const u8, │ │ 89 -) !?@This() { │ │ 98 +) !?RepoWithId { │ │ 99 // owner name -> user id │ │100 const name_to_user_id_cursor = try haxy_moment.getCursor(hash.hashInt(hash_kind, "name->user-id")) orelse return null;│ │101 const name_to_user_id = try DB.HashMap(.read_only).init(name_to_user_id_cursor); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │115 const event_id_to_repo = try DB.HashMap(.read_only).init(event_id_to_repo_cursor); │ │116 const repo_cursor = try event_id_to_repo.getCursor(hash.hashInt(hash_kind, &repo_id)) orelse return null;│ │117 const repo_map = try DB.HashMap(.read_only).init(repo_cursor); │ │109 - return try evt.read(@This(), DB, hash_kind, arena, repo_map); │ │118 + return .{ .repo = try evt.read(@This(), DB, hash_kind, arena, repo_map), .event_id = repo_id }; │ │119 } │ │120 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯