╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ event.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
2105 const children_cursor = try self.parent_to_children.putCursor(parent_oid_int); 2106 const children = try DB.HashSet(.read_write).init(children_cursor); 2107 try children.put(oid_int, .{ .bytes = &oid }); 2108 pending_parent_count += 1; 2109 } 2110 2111 if (pending_parent_count == 0) { 2112 try self.ready_queue.append(.{ .bytes = &oid }); 2113 } else { 2114 try self.child_to_pending_parents.put(oid_int, .{ .uint = pending_parent_count }); 2115 } 2116 } 2117 } 2118 2119 fn enqueueChildren(self: *CommitIterator(repo_kind, repo_opts), oid: *const [hash.byteLen(repo_opts.hash)]u8) !void { 2120 const oid_int = hash.bytesToInt(repo_opts.hash, oid); 2121 const children_cursor = try self.parent_to_children.getCursor(oid_int) orelse return; 2122 const children = try DB.HashSet(.read_only).init(children_cursor); 2123 var children_iter = try children.iterator(); 2124 2125 while (try children_iter.next()) |*child_cursor| { 2126 const kv_pair = try child_cursor.readKeyValuePair(); 2127 const child_oid_int = kv_pair.hash; 2128 const pending_parent_cursor = try self.child_to_pending_parents.getCursor(child_oid_int) orelse return error.CursorNotFound; 2129 const pending_parent_count = try pending_parent_cursor.readUint(); 2130 2131 if (pending_parent_count <= 1) { 2132 _ = try self.child_to_pending_parents.remove(child_oid_int); 2133 const child_oid = hash.intToBytes(hash.HashInt(repo_opts.hash), child_oid_int); 2134 try self.ready_queue.append(.{ .bytes = &child_oid }); 2135 } else { 2136 try self.child_to_pending_parents.put(child_oid_int, .{ .uint = pending_parent_count - 1 }); 2137 } 2138 } 2139 } 2140 2141 fn readOidFromList(list: DB.ArrayList(.read_only), index: u64) ![hash.byteLen(repo_opts.hash)]u8 { 2142 const oid_cursor = try list.getCursor(index) orelse return error.CursorNotFound; 2143 var oid: [hash.byteLen(repo_opts.hash)]u8 = undefined; 2144 _ = try oid_cursor.readBytes(&oid); 2145 return oid; 2146 } 2147 }; 2148 } 2149