╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Discussion.zig ───────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
203 io: std.Io, 204 allocator: std.mem.Allocator, 205 arena: *std.heap.ArenaAllocator, 206 repo: *rp.Repo(repo_kind, repo_opts), 207 id: *const [evt.event_id_size]u8, 208 ) !?Record { 209 const DB = evt.EventDB(repo_opts.hash); 210 var event_db_maybe: ?evt.LocalEventDB(repo_opts.hash) = if (repo_kind == .git) try evt.LocalEventDB(repo_opts.hash).openReadOnly(io, allocator, repo.core.repo_dir) else null; 211 defer if (event_db_maybe) |*event_db| event_db.deinit(io, allocator); 212 const moment = (if (event_db_maybe) |*event_db| 213 evt.currentMomentFromDb(repo_opts.hash, event_db.db) 214 else if (repo_kind == .git) 215 return null 216 else 217 evt.currentMoment(repo_opts, repo)) catch return null; 218 const records_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, record_map_key)) orelse return null; 219 const records = try DB.HashMap(.read_only).init(records_cursor); 220 const record_cursor = try records.getCursor(hash.hashInt(repo_opts.hash, id)) orelse return null; 221 return try evt.read(Record, DB, repo_opts.hash, arena, try DB.HashMap(.read_only).init(record_cursor)); 222 } 223