╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Notify.zig ───────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯
84 record.created_order = existing.created_order; 85 } 86 87 const notify_cursor = try records.putCursor(notify_key); 88 try evt.upsert(Record, DB, hash_kind, try DB.HashMap(.read_write).init(notify_cursor), record); 89 try evt.indexEvent(DB, hash_kind, haxy_moment, event_id, .notify, existing_maybe, record); 90 91 // the id set retains removed records so merges can carry removals 92 if (existing_cursor_maybe == null) { 93 const ids = try DB.SortedSet(.read_write).init(try haxy_moment.putCursor(hash.hashInt(hash_kind, all_id_set_key))); 94 try ids.put(&evt.orderKeyDesc(record.created_order, event_id)); 95 } 96 } 97 98 // the user's mode for the thread, or null without a record 99 pub fn readMode( 100 comptime DB: type, 101 comptime hash_kind: hash.HashKind, 102 haxy_moment: DB.HashMap(.read_only), 103 arena: *std.heap.ArenaAllocator, 104 repo_id: *const [evt.event_id_size]u8, 105 thread_id: *const [evt.event_id_size]u8, 106 ) !?Mode { 107 const record = (try evt.readRecordSubset(Self, struct { removed: bool, event: struct { mode: Mode } }, DB, hash_kind, haxy_moment, arena, &idOf(repo_id, thread_id))) orelse return null; 108 return if (record.removed) null else record.event.mode; 109 } 110