╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Repo.zig ─────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
182 ) !?RepoWithId { 183 const name_to_repo_id_cursor = try user_moment.getCursor(hash.hashInt(hash_kind, name_index_key)) orelse return null; 184 const name_to_repo_id = try DB.SortedMap(.read_only).init(name_to_repo_id_cursor); 185 const repo_id_cursor = try name_to_repo_id.getCursor(name) orelse return null; 186 var repo_id: [evt.event_id_size]u8 = undefined; 187 _ = try repo_id_cursor.readBytes(&repo_id); 188 const repo = (try readById(DB, hash_kind, user_moment, arena, &repo_id)) orelse return null; 189 return .{ .repo = repo, .event_id = repo_id }; 190 } 191 192 pub fn readById( 193 comptime DB: type, 194 comptime hash_kind: hash.HashKind, 195 haxy_moment: DB.HashMap(.read_only), 196 arena: *std.heap.ArenaAllocator, 197 id: []const u8, 198 ) !?Record { 199 const records_cursor = try haxy_moment.getCursor(hash.hashInt(hash_kind, record_map_key)) orelse return null; 200 const records = try DB.HashMap(.read_only).init(records_cursor); 201 const record_cursor = try records.getCursor(hash.hashInt(hash_kind, id)) orelse return null; 202 return try evt.read(Record, DB, hash_kind, arena, try DB.HashMap(.read_only).init(record_cursor)); 203 } 204