╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ event.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯
3065 const children_cursor = try self.parent_to_children.putCursor(parent_oid_int); 3066 const children = try TempDB.HashSet(.read_write).init(children_cursor); 3067 try children.put(oid_int, .{ .bytes = &oid }); 3068 pending_parent_count += 1; 3069 } 3070 3071 if (pending_parent_count == 0) { 3072 try self.ready_queue.append(.{ .bytes = &oid }); 3073 } else { 3074 try self.child_to_pending_parents.put(oid_int, .{ .uint = pending_parent_count }); 3075 } 3076 } 3077 } 3078 3079 fn enqueueChildren(self: *CommitIterator(repo_kind, repo_opts), oid: *const [hash.byteLen(repo_opts.hash)]u8) !void { 3080 const oid_int = hash.bytesToInt(repo_opts.hash, oid); 3081 const children_cursor = try self.parent_to_children.getCursor(oid_int) orelse return; 3082 const children = try TempDB.HashSet(.read_only).init(children_cursor); 3083 var children_iter = try children.iterator(); 3084 3085 while (try children_iter.next()) |*child_cursor| { 3086 const kv_pair = try child_cursor.readKeyValuePair(); 3087 const child_oid_int = kv_pair.hash; 3088 const pending_parent_cursor = try self.child_to_pending_parents.getCursor(child_oid_int) orelse return error.CursorNotFound; 3089 const pending_parent_count = try pending_parent_cursor.readUint(); 3090 3091 if (pending_parent_count <= 1) { 3092 _ = try self.child_to_pending_parents.remove(child_oid_int); 3093 const child_oid = hash.intToBytes(hash.HashInt(repo_opts.hash), child_oid_int); 3094 try self.ready_queue.append(.{ .bytes = &child_oid }); 3095 } else { 3096 try self.child_to_pending_parents.put(child_oid_int, .{ .uint = pending_parent_count - 1 }); 3097 } 3098 } 3099 } 3100 3101 fn readOidFromList(list: TempDB.ArrayList(.read_only), index: u64) ![hash.byteLen(repo_opts.hash)]u8 { 3102 const oid_cursor = try list.getCursor(index) orelse return error.CursorNotFound; 3103 var oid: [hash.byteLen(repo_opts.hash)]u8 = undefined; 3104 _ = try oid_cursor.readBytes(&oid); 3105 return oid; 3106 } 3107 }; 3108 } 3109