╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ event.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
2983 _ = try std.fmt.hexToBytes(&parent_oid_bytes, parent_oid); 2984 const parent_oid_int = hash.bytesToInt(repo_opts.hash, &parent_oid_bytes); 2985 2986 // if this object id has already been consumed, skip it 2987 if (null != try consumed_object_ids.getCursor(parent_oid_int)) { 2988 continue; 2989 } 2990 2991 // if this object id hasn't already been seen, add it to the walk queue 2992 if (null == try seen_object_ids.getCursor(parent_oid_int)) { 2993 try walk_queue.append(.{ .bytes = &parent_oid_bytes }); 2994 } 2995 2996 const children_cursor = try self.parent_to_children.putCursor(parent_oid_int); 2997 const children = try TempDB.HashSet(.read_write).init(children_cursor); 2998 try children.put(oid_int, .{ .bytes = &oid }); 2999 pending_parent_count += 1; 3000 } 3001 3002 if (pending_parent_count == 0) { 3003 try self.ready_queue.append(.{ .bytes = &oid }); 3004 } else { 3005 try self.child_to_pending_parents.put(oid_int, .{ .uint = pending_parent_count }); 3006 } 3007 } 3008 } 3009 3010 fn enqueueChildren(self: *CommitIterator(repo_kind, repo_opts), oid: *const [hash.byteLen(repo_opts.hash)]u8) !void { 3011 const oid_int = hash.bytesToInt(repo_opts.hash, oid); 3012 const children_cursor = try self.parent_to_children.getCursor(oid_int) orelse return; 3013 const children = try TempDB.HashSet(.read_only).init(children_cursor); 3014 var children_iter = try children.iterator(); 3015 3016 while (try children_iter.next()) |*child_cursor| { 3017 const kv_pair = try child_cursor.readKeyValuePair(); 3018 const child_oid_int = kv_pair.hash; 3019 const pending_parent_cursor = try self.child_to_pending_parents.getCursor(child_oid_int) orelse return error.CursorNotFound; 3020 const pending_parent_count = try pending_parent_cursor.readUint(); 3021 3022 if (pending_parent_count <= 1) { 3023 _ = try self.child_to_pending_parents.remove(child_oid_int); 3024 const child_oid = hash.intToBytes(hash.HashInt(repo_opts.hash), child_oid_int); 3025 try self.ready_queue.append(.{ .bytes = &child_oid }); 3026 } else { 3027 try self.child_to_pending_parents.put(child_oid_int, .{ .uint = pending_parent_count - 1 }); 3028 } 3029 } 3030 } 3031 3032 fn readOidFromList(list: TempDB.ArrayList(.read_only), index: u64) ![hash.byteLen(repo_opts.hash)]u8 { 3033 const oid_cursor = try list.getCursor(index) orelse return error.CursorNotFound; 3034 var oid: [hash.byteLen(repo_opts.hash)]u8 = undefined; 3035 _ = try oid_cursor.readBytes(&oid); 3036 return oid; 3037 } 3038 }; 3039 } 3040