╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ event.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
2395 if (null == try seen_object_ids.getCursor(parent_oid_int)) { 2396 try walk_queue.append(.{ .bytes = &parent_oid_bytes }); 2397 } 2398 2399 const children_cursor = try self.parent_to_children.putCursor(parent_oid_int); 2400 const children = try TempDB.HashSet(.read_write).init(children_cursor); 2401 try children.put(oid_int, .{ .bytes = &oid }); 2402 pending_parent_count += 1; 2403 } 2404 2405 if (pending_parent_count == 0) { 2406 try self.ready_queue.append(.{ .bytes = &oid }); 2407 } else { 2408 try self.child_to_pending_parents.put(oid_int, .{ .uint = pending_parent_count }); 2409 } 2410 } 2411 } 2412 2413 fn enqueueChildren(self: *CommitIterator(repo_kind, repo_opts), oid: *const [hash.byteLen(repo_opts.hash)]u8) !void { 2414 const oid_int = hash.bytesToInt(repo_opts.hash, oid); 2415 const children_cursor = try self.parent_to_children.getCursor(oid_int) orelse return; 2416 const children = try TempDB.HashSet(.read_only).init(children_cursor); 2417 var children_iter = try children.iterator(); 2418 2419 while (try children_iter.next()) |*child_cursor| { 2420 const kv_pair = try child_cursor.readKeyValuePair(); 2421 const child_oid_int = kv_pair.hash; 2422 const pending_parent_cursor = try self.child_to_pending_parents.getCursor(child_oid_int) orelse return error.CursorNotFound; 2423 const pending_parent_count = try pending_parent_cursor.readUint(); 2424 2425 if (pending_parent_count <= 1) { 2426 _ = try self.child_to_pending_parents.remove(child_oid_int); 2427 const child_oid = hash.intToBytes(hash.HashInt(repo_opts.hash), child_oid_int); 2428 try self.ready_queue.append(.{ .bytes = &child_oid }); 2429 } else { 2430 try self.child_to_pending_parents.put(child_oid_int, .{ .uint = pending_parent_count - 1 }); 2431 } 2432 } 2433 } 2434 2435 fn readOidFromList(list: TempDB.ArrayList(.read_only), index: u64) ![hash.byteLen(repo_opts.hash)]u8 { 2436 const oid_cursor = try list.getCursor(index) orelse return error.CursorNotFound; 2437 var oid: [hash.byteLen(repo_opts.hash)]u8 = undefined; 2438 _ = try oid_cursor.readBytes(&oid); 2439 return oid; 2440 } 2441 }; 2442 } 2443