╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ event.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
1186 if (null != try consumed_object_ids.getCursor(parent_oid_int)) { 1187 continue; 1188 } 1189 1190 // if this object id hasn't already been seen, add it to the walk queue 1191 if (null == try seen_object_ids.getCursor(parent_oid_int)) { 1192 try walk_queue.append(.{ .bytes = &parent_oid_bytes }); 1193 } 1194 1195 const children_cursor = try self.parent_to_children.putCursor(parent_oid_int); 1196 const children = try DB.HashSet(.read_write).init(children_cursor); 1197 try children.put(oid_int, .{ .bytes = &oid }); 1198 pending_parent_count += 1; 1199 } 1200 1201 if (pending_parent_count == 0) { 1202 try self.ready_queue.append(.{ .bytes = &oid }); 1203 } else { 1204 try self.child_to_pending_parents.put(oid_int, .{ .uint = pending_parent_count }); 1205 } 1206 } 1207 } 1208 1209 fn enqueueChildren(self: *CommitIterator(repo_kind, repo_opts), oid: *const [hash.byteLen(repo_opts.hash)]u8) !void { 1210 const oid_int = hash.bytesToInt(repo_opts.hash, oid); 1211 const children_cursor = try self.parent_to_children.getCursor(oid_int) orelse return; 1212 const children = try DB.HashSet(.read_only).init(children_cursor); 1213 var children_iter = try children.iterator(); 1214 1215 while (try children_iter.next()) |*child_cursor| { 1216 const kv_pair = try child_cursor.readKeyValuePair(); 1217 const child_oid_int = kv_pair.hash; 1218 const pending_parent_cursor = try self.child_to_pending_parents.getCursor(child_oid_int) orelse return error.CursorNotFound; 1219 const pending_parent_count = try pending_parent_cursor.readUint(); 1220 1221 if (pending_parent_count <= 1) { 1222 _ = try self.child_to_pending_parents.remove(child_oid_int); 1223 const child_oid = hash.intToBytes(hash.HashInt(repo_opts.hash), child_oid_int); 1224 try self.ready_queue.append(.{ .bytes = &child_oid }); 1225 } else { 1226 try self.child_to_pending_parents.put(child_oid_int, .{ .uint = pending_parent_count - 1 }); 1227 } 1228 } 1229 } 1230 1231 fn readOidFromList(list: DB.ArrayList(.read_only), index: u64) ![hash.byteLen(repo_opts.hash)]u8 { 1232 const oid_cursor = try list.getCursor(index) orelse return error.CursorNotFound; 1233 var oid: [hash.byteLen(repo_opts.hash)]u8 = undefined; 1234 _ = try oid_cursor.readBytes(&oid); 1235 return oid; 1236 } 1237 }; 1238 } 1239