Documentation
¶
Overview ¶
Package recents is the "recently viewed" entries (migration 0018) — the session switcher's Recent view, and where home goes with no chief: per user, server-stored, so they follow their owner across devices. An entry names a dispatched agent or a mirrored tmux window, keyed exactly as a pin is (pins.MirrorKey).
🔴 EVERY METHOD RUNS UNDER THE CALLER'S PRINCIPAL. recents is under FORCE row-level security, so a request reads and writes only its own user's rows; there is no system method. The owner of a row is the principal's user (owner_id's default), never a parameter.
Index ¶
Constants ¶
const MaxPerOwner = 50
MaxPerOwner bounds one user's rows. Each visit prunes the oldest past it, so a mirror row whose window is gone ages out rather than piling up. Two concurrent visits may leave one row past it until the next visit: a strip that shows six does not care.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
Entry is one recently opened subject: an agent (AgentID, Mirror zero) or a mirrored entry (Mirror, AgentID 0).
type PGStore ¶
type PGStore struct {
// contains filtered or unexported fields
}
PGStore is Store on Postgres.
func (*PGStore) List ¶
List is the caller's entries, newest first — all of them, which the prune keeps to about MaxPerOwner. Ties (one transaction's two visits) break by id, the later row first.
func (*PGStore) VisitAgent ¶
VisitAgent records that the caller opened agent id now. An agent the caller cannot see (absent, or another user's) is refused by the owner trigger or the foreign key, and that error is returned as is.