╭ changed ──────╮ │src/ui/Home.zig│ ╰───────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────╮ │2 const ui = @import("../ui.zig");│ │3 const xit = @import("xit"); │ │4 const rp = xit.repo; │ │5 -const hash = xit.hash; │ │5 const xitui = xit.xitui; │ │6 const wgt = xitui.widget; │ │7 const layout = xitui.layout; │ ╰───────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │24 pub fn init( │ │25 comptime repo_opts: rp.RepoOpts(.xit), │ │26 arena: *std.heap.ArenaAllocator, │ │28 - repo: *rp.Repo(.xit, repo_opts), │ │29 - session: *ui.Session, │ │27 + haxy_moment: rp.Repo(.xit, repo_opts).DB.HashMap(.read_only), │ │28 ) !Self { │ │31 - const DB = rp.Repo(.xit, repo_opts).DB; │ │32 - │ │33 - const history = try DB.ArrayList(.read_only).init(repo.core.db.rootCursor().readOnly()); │ │34 - │ │35 - const moment_cursor = try history.getCursor(-1) orelse return error.NotFound; │ │36 - const moment = try DB.HashMap(.read_only).init(moment_cursor); │ │37 - │ │38 - const last_object_id_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, "haxy-last-object-id")) orelse return error.NotFound;│ │39 - var last_object_id: [hash.byteLen(repo_opts.hash)]u8 = undefined; │ │40 - _ = try last_object_id_cursor.readBytes(&last_object_id); │ │41 - │ │42 - const haxy_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, "haxy")) orelse return error.NotFound; │ │43 - const haxy = try DB.ArrayList(.read_only).init(haxy_cursor); │ │44 - │ │45 - const haxy_moments_cursor = try haxy.getCursor(-1) orelse return error.NotFound; │ │46 - const haxy_moments = try DB.HashMap(.read_only).init(haxy_moments_cursor); │ │47 - │ │48 - const haxy_moment_cursor = try haxy_moments.getCursor(hash.bytesToInt(repo_opts.hash, &last_object_id)) orelse return error.NotFound;│ │49 - const haxy_moment = try DB.HashMap(.read_only).init(haxy_moment_cursor); │ │50 - │ │51 - // hand the cursor + arena off to the session so Login (and any future │ │52 - // page that needs DB access at input time) can use them on demand. │ │53 - session.arena = arena; │ │54 - session.haxy_moment = haxy_moment; │ │55 - │ │29 return .{ │ │30 .header = Header.init(), │ │31 .users = try Users.init(repo_opts, arena, haxy_moment), │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯