╭ changed ─────────╮ │src/test/event.zig│ ╰──────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │115 │ │116 { │ │117 try evt.consume(repo_opts, io, allocator, &repo, .{ .kind = .head, .name = "haxy/meta" }); │ │118 - │ │119 - const history = try Repo.DB.ArrayList(.read_only).init(repo.core.db.rootCursor().readOnly()); │ │120 - │ │121 - // read the moment we just created │ │122 - const moment_cursor = try history.getCursor(-1) orelse return error.NotFound; │ │123 - const moment = try Repo.DB.HashMap(.read_only).init(moment_cursor); │ │124 - │ │125 - // get the last object id │ │126 - const last_object_id_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, "haxy-last-object-id")) orelse return error.NotFound; │ │127 - var last_object_id: [hash.byteLen(repo_opts.hash)]u8 = undefined; │ │128 - _ = try last_object_id_cursor.readBytes(&last_object_id); │ │129 - │ │130 - const haxy_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, "haxy")) orelse return error.NotFound; │ │131 - const haxy = try Repo.DB.ArrayList(.read_only).init(haxy_cursor); │ │132 - │ │133 - try std.testing.expectEqual(1, try haxy.count()); │ │118 │ │135 - const haxy_moments_cursor = try haxy.getCursor(-1) orelse return error.NotFound; │ │136 - const haxy_moments = try Repo.DB.HashMap(.read_only).init(haxy_moments_cursor); │ │119 + const haxy_moment = try evt.currentMoment(repo_opts, &repo); │ │120 │ │138 - const haxy_moment_cursor = try haxy_moments.getCursor(hash.bytesToInt(repo_opts.hash, &last_object_id)) orelse return error.NotFound; │ │139 - const haxy_moment = try Repo.DB.HashMap(.read_only).init(haxy_moment_cursor); │ │140 - │ │121 // get the map of issues │ │122 const event_id_to_issue_cursor = try haxy_moment.getCursor(hash.hashInt(repo_opts.hash, "event-id->issue")) orelse return error.NotFound;│ │123 const event_id_to_issue = try Repo.DB.HashMap(.read_only).init(event_id_to_issue_cursor); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │150 }, │ │151 }, │ │152 }; │ │173 - │ │174 - { │ │175 - var json: std.Io.Writer.Allocating = .init(allocator); │ │176 - defer json.deinit(); │ │153 │ │178 - for (events_to_consume2) |event| { │ │179 - json.clearRetainingCapacity(); │ │154 + // commit and consume the new event │ │155 + try evt.commitAndConsume(repo_opts, io, allocator, &repo, .{ .kind = .head, .name = "haxy/meta" }, &events_to_consume2); │ │156 │ │181 - try std.json.Stringify.value(event, .{}, &json.writer); │ │182 - │ │183 - // commit the event into a special branch │ │184 - _ = try repo.commitAtRef(io, allocator, .{ .message = json.written() }, null, .{ .kind = .head, .name = "haxy/meta" }); │ │185 - } │ │186 - } │ │187 - │ │188 - // │ │189 - // consume events into the database │ │157 // │ │191 - │ │192 - { │ │193 - try evt.consume(repo_opts, io, allocator, &repo, .{ .kind = .head, .name = "haxy/meta" }); │ │194 - │ │195 - const history = try Repo.DB.ArrayList(.read_only).init(repo.core.db.rootCursor().readOnly()); │ │196 - │ │197 - // read the moment we just created │ │198 - const moment_cursor = try history.getCursor(-1) orelse return error.NotFound; │ │199 - const moment = try Repo.DB.HashMap(.read_only).init(moment_cursor); │ │200 - │ │201 - // get the last object id │ │202 - const last_object_id_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, "haxy-last-object-id")) orelse return error.NotFound;│ │203 - var last_object_id: [hash.byteLen(repo_opts.hash)]u8 = undefined; │ │204 - _ = try last_object_id_cursor.readBytes(&last_object_id); │ │205 - │ │206 - const haxy_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, "haxy")) orelse return error.NotFound; │ │207 - const haxy = try Repo.DB.ArrayList(.read_only).init(haxy_cursor); │ │208 - │ │209 - try std.testing.expectEqual(2, try haxy.count()); │ │210 - } │ │211 - │ │212 - // │ │158 // rebase the branch so it no longer includes the edit event │ │159 // │ │160 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │196 │ │197 { │ │198 try evt.consume(repo_opts, io, allocator, &repo, .{ .kind = .head, .name = "haxy/meta" }); │ │254 - │ │255 - const history = try Repo.DB.ArrayList(.read_only).init(repo.core.db.rootCursor().readOnly()); │ │199 │ │257 - // read the moment we just created │ │258 - const moment_cursor = try history.getCursor(-1) orelse return error.NotFound; │ │259 - const moment = try Repo.DB.HashMap(.read_only).init(moment_cursor); │ │200 + const haxy_moment = try evt.currentMoment(repo_opts, &repo); │ │201 │ │261 - // get the last object id │ │262 - const last_object_id_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, "haxy-last-object-id")) orelse return error.NotFound; │ │263 - var last_object_id: [hash.byteLen(repo_opts.hash)]u8 = undefined; │ │264 - _ = try last_object_id_cursor.readBytes(&last_object_id); │ │265 - │ │266 - const haxy_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, "haxy")) orelse return error.NotFound; │ │267 - const haxy = try Repo.DB.ArrayList(.read_only).init(haxy_cursor); │ │268 - │ │269 - try std.testing.expectEqual(2, try haxy.count()); │ │270 - │ │271 - const haxy_moments_cursor = try haxy.getCursor(-1) orelse return error.NotFound; │ │272 - const haxy_moments = try Repo.DB.HashMap(.read_only).init(haxy_moments_cursor); │ │273 - │ │274 - const haxy_moment_cursor = try haxy_moments.getCursor(hash.bytesToInt(repo_opts.hash, &last_object_id)) orelse return error.NotFound; │ │275 - const haxy_moment = try Repo.DB.HashMap(.read_only).init(haxy_moment_cursor); │ │276 - │ │202 // get the map of issues │ │203 const event_id_to_issue_cursor = try haxy_moment.getCursor(hash.hashInt(repo_opts.hash, "event-id->issue")) orelse return error.NotFound;│ │204 const event_id_to_issue = try Repo.DB.HashMap(.read_only).init(event_id_to_issue_cursor); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │255 │ │256 { │ │257 try evt.consume(repo_opts, io, allocator, &repo, .{ .kind = .head, .name = "haxy/meta" }); │ │333 - │ │334 - const history = try Repo.DB.ArrayList(.read_only).init(repo.core.db.rootCursor().readOnly()); │ │335 - │ │336 - // read the moment we just created │ │337 - const moment_cursor = try history.getCursor(-1) orelse return error.NotFound; │ │338 - const moment = try Repo.DB.HashMap(.read_only).init(moment_cursor); │ │339 - │ │340 - // get the last object id │ │341 - const last_object_id_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, "haxy-last-object-id")) orelse return error.NotFound; │ │342 - var last_object_id: [hash.byteLen(repo_opts.hash)]u8 = undefined; │ │343 - _ = try last_object_id_cursor.readBytes(&last_object_id); │ │344 - │ │345 - const haxy_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, "haxy")) orelse return error.NotFound; │ │346 - const haxy = try Repo.DB.ArrayList(.read_only).init(haxy_cursor); │ │347 - │ │348 - try std.testing.expectEqual(1, try haxy.count()); │ │349 - │ │350 - const haxy_moments_cursor = try haxy.getCursor(-1) orelse return error.NotFound; │ │351 - const haxy_moments = try Repo.DB.HashMap(.read_only).init(haxy_moments_cursor); │ │258 │ │353 - const haxy_moment_cursor = try haxy_moments.getCursor(hash.bytesToInt(repo_opts.hash, &last_object_id)) orelse return error.NotFound; │ │354 - const haxy_moment = try Repo.DB.HashMap(.read_only).init(haxy_moment_cursor); │ │259 + const haxy_moment = try evt.currentMoment(repo_opts, &repo); │ │260 │ │261 // get the map of issues │ │262 const event_id_to_issue_cursor = try haxy_moment.getCursor(hash.hashInt(repo_opts.hash, "event-id->issue")) orelse return error.NotFound;│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │365 │ │366 { │ │367 try evt.consume(repo_opts, io, allocator, &repo, .{ .kind = .head, .name = "haxy/meta" }); │ │463 - │ │464 - const history = try Repo.DB.ArrayList(.read_only).init(repo.core.db.rootCursor().readOnly()); │ │465 - │ │466 - // read the moment we just created │ │467 - const moment_cursor = try history.getCursor(-1) orelse return error.NotFound; │ │468 - const moment = try Repo.DB.HashMap(.read_only).init(moment_cursor); │ │469 - │ │470 - // get the last object id │ │471 - const last_object_id_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, "haxy-last-object-id")) orelse return error.NotFound; │ │472 - var last_object_id: [hash.byteLen(repo_opts.hash)]u8 = undefined; │ │473 - _ = try last_object_id_cursor.readBytes(&last_object_id); │ │474 - │ │475 - const haxy_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, "haxy")) orelse return error.NotFound; │ │476 - const haxy = try Repo.DB.ArrayList(.read_only).init(haxy_cursor); │ │477 - │ │478 - try std.testing.expectEqual(1, try haxy.count()); │ │368 │ │480 - const haxy_moments_cursor = try haxy.getCursor(-1) orelse return error.NotFound; │ │481 - const haxy_moments = try Repo.DB.HashMap(.read_only).init(haxy_moments_cursor); │ │369 + const haxy_moment = try evt.currentMoment(repo_opts, &repo); │ │370 │ │483 - const haxy_moment_cursor = try haxy_moments.getCursor(hash.bytesToInt(repo_opts.hash, &last_object_id)) orelse return error.NotFound; │ │484 - const haxy_moment = try Repo.DB.HashMap(.read_only).init(haxy_moment_cursor); │ │485 - │ │371 // get the map of issues │ │372 const event_id_to_issue_cursor = try haxy_moment.getCursor(hash.hashInt(repo_opts.hash, "event-id->issue")) orelse return error.NotFound;│ │373 const event_id_to_issue = try Repo.DB.HashMap(.read_only).init(event_id_to_issue_cursor); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │467 │ │468 { │ │469 try evt.consume(repo_opts, io, allocator, &repo, .{ .kind = .head, .name = "haxy/meta" }); │ │585 - │ │586 - const history = try Repo.DB.ArrayList(.read_only).init(repo.core.db.rootCursor().readOnly()); │ │587 - │ │588 - // read the moment we just created │ │589 - const moment_cursor = try history.getCursor(-1) orelse return error.NotFound; │ │590 - const moment = try Repo.DB.HashMap(.read_only).init(moment_cursor); │ │591 - │ │592 - // get the last object id │ │593 - const last_object_id_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, "haxy-last-object-id")) orelse return error.NotFound; │ │594 - var last_object_id: [hash.byteLen(repo_opts.hash)]u8 = undefined; │ │595 - _ = try last_object_id_cursor.readBytes(&last_object_id); │ │596 - │ │597 - const haxy_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, "haxy")) orelse return error.NotFound; │ │598 - const haxy = try Repo.DB.ArrayList(.read_only).init(haxy_cursor); │ │470 │ │600 - try std.testing.expectEqual(2, try haxy.count()); │ │471 + const haxy_moment = try evt.currentMoment(repo_opts, &repo); │ │472 │ │602 - const haxy_moments_cursor = try haxy.getCursor(-1) orelse return error.NotFound; │ │603 - const haxy_moments = try Repo.DB.HashMap(.read_only).init(haxy_moments_cursor); │ │604 - │ │605 - const haxy_moment_cursor = try haxy_moments.getCursor(hash.bytesToInt(repo_opts.hash, &last_object_id)) orelse return error.NotFound; │ │606 - const haxy_moment = try Repo.DB.HashMap(.read_only).init(haxy_moment_cursor); │ │607 - │ │473 // get the map of issues │ │474 const event_id_to_issue_cursor = try haxy_moment.getCursor(hash.hashInt(repo_opts.hash, "event-id->issue")) orelse return error.NotFound;│ │475 const event_id_to_issue = try Repo.DB.HashMap(.read_only).init(event_id_to_issue_cursor); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │534 { │ │535 try evt.consume(repo_opts, io, allocator, &repo, .{ .kind = .head, .name = "haxy/meta" }); │ │536 │ │672 - const history = try Repo.DB.ArrayList(.read_only).init(repo.core.db.rootCursor().readOnly()); │ │537 + const haxy_moment = try evt.currentMoment(repo_opts, &repo); │ │538 │ │674 - // read the moment we just created │ │675 - const moment_cursor = try history.getCursor(-1) orelse return error.NotFound; │ │676 - const moment = try Repo.DB.HashMap(.read_only).init(moment_cursor); │ │677 - │ │678 - // get the last object id │ │679 - const last_object_id_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, "haxy-last-object-id")) orelse return error.NotFound; │ │680 - var last_object_id: [hash.byteLen(repo_opts.hash)]u8 = undefined; │ │681 - _ = try last_object_id_cursor.readBytes(&last_object_id); │ │682 - │ │683 - const haxy_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, "haxy")) orelse return error.NotFound; │ │684 - const haxy = try Repo.DB.ArrayList(.read_only).init(haxy_cursor); │ │685 - │ │686 - try std.testing.expectEqual(1, try haxy.count()); │ │687 - │ │688 - const haxy_moments_cursor = try haxy.getCursor(-1) orelse return error.NotFound; │ │689 - const haxy_moments = try Repo.DB.HashMap(.read_only).init(haxy_moments_cursor); │ │690 - │ │691 - const haxy_moment_cursor = try haxy_moments.getCursor(hash.bytesToInt(repo_opts.hash, &last_object_id)) orelse return error.NotFound; │ │692 - const haxy_moment = try Repo.DB.HashMap(.read_only).init(haxy_moment_cursor); │ │693 - │ │539 // get the map of issues │ │540 const event_id_to_issue_cursor = try haxy_moment.getCursor(hash.hashInt(repo_opts.hash, "event-id->issue")) orelse return error.NotFound;│ │541 const event_id_to_issue = try Repo.DB.HashMap(.read_only).init(event_id_to_issue_cursor); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │706 }, │ │707 }, │ │708 }; │ │864 - │ │865 - // │ │866 - // insert users and repos as commits in the repo │ │867 - // │ │868 - │ │869 - { │ │870 - var json: std.Io.Writer.Allocating = .init(allocator); │ │871 - defer json.deinit(); │ │709 │ │873 - for (events_to_consume) |event| { │ │874 - json.clearRetainingCapacity(); │ │875 - │ │876 - try std.json.Stringify.value(event, .{}, &json.writer); │ │877 - │ │878 - // commit the event into a special branch │ │879 - _ = try repo.commitAtRef(io, allocator, .{ .message = json.written() }, null, .{ .kind = .head, .name = "haxy/meta" }); │ │880 - } │ │881 - } │ │882 - │ │883 - // │ │884 - // consume events into the database │ │885 - // │ │710 + // commit and consume the seed events │ │711 + try evt.commitAndConsume(repo_opts, io, allocator, &repo, .{ .kind = .head, .name = "haxy/meta" }, &events_to_consume); │ │712 │ │713 { │ │888 - try evt.consume(repo_opts, io, allocator, &repo, .{ .kind = .head, .name = "haxy/meta" }); │ │889 - │ │890 - const history = try Repo.DB.ArrayList(.read_only).init(repo.core.db.rootCursor().readOnly()); │ │891 - │ │892 - // read the moment we just created │ │893 - const moment_cursor = try history.getCursor(-1) orelse return error.NotFound; │ │894 - const moment = try Repo.DB.HashMap(.read_only).init(moment_cursor); │ │895 - │ │896 - // get the last object id │ │897 - const last_object_id_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, "haxy-last-object-id")) orelse return error.NotFound; │ │898 - var last_object_id: [hash.byteLen(repo_opts.hash)]u8 = undefined; │ │899 - _ = try last_object_id_cursor.readBytes(&last_object_id); │ │900 - │ │901 - const haxy_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, "haxy")) orelse return error.NotFound; │ │902 - const haxy = try Repo.DB.ArrayList(.read_only).init(haxy_cursor); │ │903 - │ │904 - try std.testing.expectEqual(1, try haxy.count()); │ │905 - │ │906 - const haxy_moments_cursor = try haxy.getCursor(-1) orelse return error.NotFound; │ │907 - const haxy_moments = try Repo.DB.HashMap(.read_only).init(haxy_moments_cursor); │ │908 - │ │909 - const haxy_moment_cursor = try haxy_moments.getCursor(hash.bytesToInt(repo_opts.hash, &last_object_id)) orelse return error.NotFound; │ │910 - const haxy_moment = try Repo.DB.HashMap(.read_only).init(haxy_moment_cursor); │ │714 + const haxy_moment = try evt.currentMoment(repo_opts, &repo); │ │715 │ │716 // get the map of users │ │717 const event_id_to_user_cursor = try haxy_moment.getCursor(hash.hashInt(repo_opts.hash, "event-id->user")) orelse return error.NotFound;│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 759 .event = .{ .repo = null }, │ │ 760 }, │ │ 761 }; │ │ 958 - │ │ 959 - { │ │ 960 - var json: std.Io.Writer.Allocating = .init(allocator); │ │ 961 - defer json.deinit(); │ │ 962 - │ │ 963 - for (events_to_consume2) |event| { │ │ 964 - json.clearRetainingCapacity(); │ │ 965 - │ │ 966 - try std.json.Stringify.value(event, .{}, &json.writer); │ │ 967 - │ │ 968 - // commit the event into a special branch │ │ 969 - _ = try repo.commitAtRef(io, allocator, .{ .message = json.written() }, null, .{ .kind = .head, .name = "haxy/meta" }); │ │ 970 - } │ │ 971 - } │ │ 762 │ │ 973 - // │ │ 974 - // consume the removal into the database │ │ 975 - // │ │ 763 + // commit and consume the removal │ │ 764 + try evt.commitAndConsume(repo_opts, io, allocator, &repo, .{ .kind = .head, .name = "haxy/meta" }, &events_to_consume2); │ │ 765 │ │ 766 { │ │ 978 - try evt.consume(repo_opts, io, allocator, &repo, .{ .kind = .head, .name = "haxy/meta" }); │ │ 979 - │ │ 980 - const history = try Repo.DB.ArrayList(.read_only).init(repo.core.db.rootCursor().readOnly()); │ │ 981 - │ │ 982 - // read the moment we just created │ │ 983 - const moment_cursor = try history.getCursor(-1) orelse return error.NotFound; │ │ 984 - const moment = try Repo.DB.HashMap(.read_only).init(moment_cursor); │ │ 985 - │ │ 986 - // get the last object id │ │ 987 - const last_object_id_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, "haxy-last-object-id")) orelse return error.NotFound; │ │ 988 - var last_object_id: [hash.byteLen(repo_opts.hash)]u8 = undefined; │ │ 989 - _ = try last_object_id_cursor.readBytes(&last_object_id); │ │ 990 - │ │ 991 - const haxy_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, "haxy")) orelse return error.NotFound; │ │ 992 - const haxy = try Repo.DB.ArrayList(.read_only).init(haxy_cursor); │ │ 993 - │ │ 994 - try std.testing.expectEqual(2, try haxy.count()); │ │ 767 + const haxy_moment = try evt.currentMoment(repo_opts, &repo); │ │ 768 │ │ 996 - const haxy_moments_cursor = try haxy.getCursor(-1) orelse return error.NotFound; │ │ 997 - const haxy_moments = try Repo.DB.HashMap(.read_only).init(haxy_moments_cursor); │ │ 998 - │ │ 999 - const haxy_moment_cursor = try haxy_moments.getCursor(hash.bytesToInt(repo_opts.hash, &last_object_id)) orelse return error.NotFound; │ │1000 - const haxy_moment = try Repo.DB.HashMap(.read_only).init(haxy_moment_cursor); │ │1001 - │ │ 769 // get the map of repos │ │ 770 const event_id_to_repo_cursor = try haxy_moment.getCursor(hash.hashInt(repo_opts.hash, "event-id->repo")) orelse return error.NotFound;│ │ 771 const event_id_to_repo = try Repo.DB.HashMap(.read_only).init(event_id_to_repo_cursor); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 793 .event = .{ .user = null }, │ │ 794 }, │ │ 795 }; │ │1029 - │ │1030 - { │ │1031 - var json: std.Io.Writer.Allocating = .init(allocator); │ │1032 - defer json.deinit(); │ │1033 - │ │1034 - for (events_to_consume3) |event| { │ │1035 - json.clearRetainingCapacity(); │ │ 796 │ │1037 - try std.json.Stringify.value(event, .{}, &json.writer); │ │1038 - │ │1039 - // commit the event into a special branch │ │1040 - _ = try repo.commitAtRef(io, allocator, .{ .message = json.written() }, null, .{ .kind = .head, .name = "haxy/meta" }); │ │1041 - } │ │1042 - } │ │ 797 + // commit and consume the removal │ │ 798 + try evt.commitAndConsume(repo_opts, io, allocator, &repo, .{ .kind = .head, .name = "haxy/meta" }, &events_to_consume3); │ │ 799 │ │1044 - // │ │1045 - // consume the user removal into the database │ │1046 - // │ │1047 - │ │ 800 { │ │1049 - try evt.consume(repo_opts, io, allocator, &repo, .{ .kind = .head, .name = "haxy/meta" }); │ │1050 - │ │1051 - const history = try Repo.DB.ArrayList(.read_only).init(repo.core.db.rootCursor().readOnly()); │ │1052 - │ │1053 - // read the moment we just created │ │1054 - const moment_cursor = try history.getCursor(-1) orelse return error.NotFound; │ │1055 - const moment = try Repo.DB.HashMap(.read_only).init(moment_cursor); │ │1056 - │ │1057 - // get the last object id │ │1058 - const last_object_id_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, "haxy-last-object-id")) orelse return error.NotFound; │ │1059 - var last_object_id: [hash.byteLen(repo_opts.hash)]u8 = undefined; │ │1060 - _ = try last_object_id_cursor.readBytes(&last_object_id); │ │ 801 + const haxy_moment = try evt.currentMoment(repo_opts, &repo); │ │ 802 │ │1062 - const haxy_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, "haxy")) orelse return error.NotFound; │ │1063 - const haxy = try Repo.DB.ArrayList(.read_only).init(haxy_cursor); │ │1064 - │ │1065 - try std.testing.expectEqual(3, try haxy.count()); │ │1066 - │ │1067 - const haxy_moments_cursor = try haxy.getCursor(-1) orelse return error.NotFound; │ │1068 - const haxy_moments = try Repo.DB.HashMap(.read_only).init(haxy_moments_cursor); │ │1069 - │ │1070 - const haxy_moment_cursor = try haxy_moments.getCursor(hash.bytesToInt(repo_opts.hash, &last_object_id)) orelse return error.NotFound; │ │1071 - const haxy_moment = try Repo.DB.HashMap(.read_only).init(haxy_moment_cursor); │ │1072 - │ │ 803 // get the map of users │ │ 804 const event_id_to_user_cursor = try haxy_moment.getCursor(hash.hashInt(repo_opts.hash, "event-id->user")) orelse return error.NotFound;│ │ 805 const event_id_to_user = try Repo.DB.HashMap(.read_only).init(event_id_to_user_cursor); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯