╭ changed ────╮ │src/event.zig│ ╰─────────────╯ ╭─────────────────────────────────────────────────────────────────────────────╮ │23 // the branch haxy events are committed to before being consumed │ │24 pub const events_ref: rf.Ref = .{ .kind = .head, .name = "haxy/events" };│ │25 │ │26 -pub const materialized_key = "haxy"; │ │27 -pub const last_object_id_key = "haxy-last-object-id"; │ │26 +pub const history_key = "haxy/history"; │ │27 +pub const last_object_id_key = "haxy/last-object-id"; │ │28 │ │29 // options + db type for the admin repo │ │30 pub const admin_repo_opts: rp.RepoOpts(.xit) = .{}; │ ╰─────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────╮ │726 // the reason it is a list is so we can keep every previous haxy │ │727 // state, making it easy to revert to an older state if the user │ │728 // rebases some of the past commits. │ │729 - const haxy_cursor = try moment.putCursor(hash.hashInt(repo_opts.hash, materialized_key)); │ │730 - const haxy = try DB.ArrayList(.read_write).init(haxy_cursor); │ │729 + const haxy_history_cursor = try moment.putCursor(hash.hashInt(repo_opts.hash, history_key));│ │730 + const haxy_history = try DB.ArrayList(.read_write).init(haxy_history_cursor); │ │731 │ │732 - // add a new item to the haxy list created above. │ │732 + // add a new item to the haxy history list created above. │ │733 // we call the item haxy_moments. it is a map of object id to haxy moment. │ │734 // in other words, it maps each object id to a hash map containing the │ │735 // state that the database was in when that object id was consumed. │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────╮ │736 - var haxy_moments_cursor = try haxy.appendCursor(); │ │736 + var haxy_moments_cursor = try haxy_history.appendCursor(); │ │737 // use the previous haxy_moments as the basis for this one if it exists │ │738 - if (try haxy.getCursor(-2)) |last_haxy_moments_cursor| { │ │738 + if (try haxy_history.getCursor(-2)) |last_haxy_moments_cursor| { │ │739 try haxy_moments_cursor.write(.{ .slot = last_haxy_moments_cursor.slot() });│ │740 } │ │741 var haxy_moments = try DB.HashMap(.read_write).init(haxy_moments_cursor); │ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │758 const moment_index_cursor = try haxy_moment.getCursor(hash.hashInt(repo_opts.hash, "moment-index")) orelse return error.CursorNotFound;│ │759 const moment_index = try moment_index_cursor.readUint(); │ │760 │ │761 - try haxy.slice(moment_index + 1); │ │761 + try haxy_history.slice(moment_index + 1); │ │762 try moment.put(hash.hashInt(repo_opts.hash, last_object_id_key), .{ .bytes = &head_oid }); │ │763 return true; │ │764 } │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ │794 0 => { │ │795 // the branch was rebased all the way to the very beginning. │ │796 // we have a repo event with no parent, which means it is now │ │797 - // the very first event. all we need to do is set the haxy list │ │798 - // to be empty and make a new haxy_moments map to work with. │ │797 + // the very first event. all we need to do is set the haxy │ │798 + // history list to be empty and make a new haxy_moments map │ │799 + // to work with. │ │800 │ │800 - try haxy.slice(0); │ │801 - haxy_moments_cursor = try haxy.appendCursor(); │ │801 + try haxy_history.slice(0); │ │802 + haxy_moments_cursor = try haxy_history.appendCursor(); │ │803 haxy_moments = try DB.HashMap(.read_write).init(haxy_moments_cursor);│ │804 │ │805 last_object_id_maybe = null; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │814 const old_moment_index_cursor = try old_moment.getCursor(hash.hashInt(repo_opts.hash, "moment-index")) orelse return error.CursorNotFound;│ │815 const old_moment_index = try old_moment_index_cursor.readUint(); │ │816 │ │816 - // resize the haxy list so we truncate all the moments that were │ │817 - // created after the parent_oid was consumed │ │818 - try haxy.slice(old_moment_index + 1); │ │817 + // resize the haxy history list so we truncate all the │ │818 + // moments that were created after the parent_oid was consumed │ │819 + try haxy_history.slice(old_moment_index + 1); │ │820 │ │821 // make a new haxy moment and set its initial value to the last haxy moment │ │821 - haxy_moments_cursor = try haxy.appendCursor(); │ │822 - const old_haxy_moments_cursor = try haxy.getCursor(old_moment_index) orelse return error.CursorNotFound; │ │822 + haxy_moments_cursor = try haxy_history.appendCursor(); │ │823 + const old_haxy_moments_cursor = try haxy_history.getCursor(old_moment_index) orelse return error.CursorNotFound; │ │824 try haxy_moments_cursor.write(.{ .slot = old_haxy_moments_cursor.slot() }); │ │825 haxy_moments = try DB.HashMap(.read_write).init(haxy_moments_cursor); │ │826 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │892 } │ │893 } │ │894 │ │894 - // associate this moment with the index it will first appear at in the haxy list. │ │895 - // this will be important later so we can truncate that list if the user ever │ │896 - // rebases starting at this object id. │ │897 - try haxy_moment.put(hash.hashInt(repo_opts.hash, "moment-index"), .{ .uint = try haxy.count() - 1 }); │ │895 + // associate this moment with the index it will first appear at in the │ │896 + // haxy history list. this will be important later so we can truncate │ │897 + // that list if the user ever rebases starting at this object id. │ │898 + try haxy_moment.put(hash.hashInt(repo_opts.hash, "moment-index"), .{ .uint = try haxy_history.count() - 1 });│ │899 │ │900 // consume the event unless it's a merge commit │ │901 if (parent_oids.len <= 1) { │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1416 const last_object_id_cursor = try moment.getCursor(hash.hashInt(hash_kind, last_object_id_key)) orelse return error.NotFound; │ │1417 var last_object_id: [hash.byteLen(hash_kind)]u8 = undefined; │ │1418 _ = try last_object_id_cursor.readBytes(&last_object_id); │ │1418 - const haxy_cursor = try moment.getCursor(hash.hashInt(hash_kind, materialized_key)) orelse return error.NotFound; │ │1419 - const haxy = try DB.ArrayList(.read_only).init(haxy_cursor); │ │1420 - const haxy_moments_cursor = try haxy.getCursor(-1) orelse return error.NotFound; │ │1419 + const haxy_history_cursor = try moment.getCursor(hash.hashInt(hash_kind, history_key)) orelse return error.NotFound; │ │1420 + const haxy_history = try DB.ArrayList(.read_only).init(haxy_history_cursor); │ │1421 + const haxy_moments_cursor = try haxy_history.getCursor(-1) orelse return error.NotFound; │ │1422 const haxy_moments = try DB.HashMap(.read_only).init(haxy_moments_cursor); │ │1423 const haxy_moment_cursor = try haxy_moments.getCursor(hash.bytesToInt(hash_kind, &last_object_id)) orelse return error.NotFound;│ │1424 return try DB.HashMap(.read_only).init(haxy_moment_cursor); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ───╮ │src/find.zig│ ╰────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────╮ │12 // haxy moment because pushes change it and events never do. each entry is │ │13 // keyed by its branch name's hash: its value is the branch's file map, and its│ │14 // key slot holds the root tree oid that map covers rather than the name. │ │15 -const index_key = "branch->file-name+path->oid"; │ │15 +const index_key = "haxy/branch->file-name+path->oid"; │ │16 │ │17 // what a search returns: the matching files and whether the cap cut the list │ │18 // short. │ ╰───────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ───╮ │src/fork.zig│ ╰────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ │136 else => |other| return other, │ │137 }; │ │138 │ │139 - _ = try moment.remove(hash.hashInt(repo_opts.hash, evt.materialized_key)); │ │139 + _ = try moment.remove(hash.hashInt(repo_opts.hash, evt.history_key)); │ │140 _ = try moment.remove(hash.hashInt(repo_opts.hash, evt.last_object_id_key));│ │141 │ │142 if (head_oid_maybe) |*head_oid| { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯