╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Grant.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
112 comptime hash_kind: hash.HashKind, 113 haxy_moment: DB.HashMap(.read_only), 114 arena: *std.heap.ArenaAllocator, 115 target_id: []const u8, 116 ) ![]const Self { 117 var grants: std.ArrayList(Self) = .empty; 118 const by_target_cursor = try haxy_moment.getCursor(hash.hashInt(hash_kind, target_to_grant_id_set_key)) orelse return grants.items; 119 const by_target = try DB.HashMap(.read_only).init(by_target_cursor); 120 const target_grants_cursor = try by_target.getCursor(hash.hashInt(hash_kind, target_id)) orelse return grants.items; 121 const target_grants = try DB.SortedSet(.read_only).init(target_grants_cursor); 122 123 var iter = try target_grants.iteratorFromIndex(0); 124 while (try iter.next()) |kv_cursor| { 125 const grant_id = try evt.readOrderKeyId(DB, kv_cursor); 126 const grant = (try evt.readRecordSubset(Self, struct { event: Self }, DB, hash_kind, haxy_moment, arena, &grant_id)) orelse continue; 127 try grants.append(arena.allocator(), grant.event); 128 } 129 return grants.items; 130 } 131