Expand description
What the event store lets go of: the notes it has had for longer than they are likely to be looked at again.
Everything the relays answer with is kept in the store, which is why a feed, a thread or a profile shows at once the second time. Nothing in it was ever let go of, and it grew for as long as it was used. A sweep takes out what is older than a given moment, by the date each event says it was written: not by when it was last looked at, which the store doesn’t know.
What is swept is what can be asked of the relays again, and is asked again when it is looked at: other people’s notes, comments, reposts, reactions and zap receipts. What is kept, however old:
- what the account wrote itself, of any kind;
- whatever there is one of for each person, since its date says nothing of whether it still holds: profiles, contact lists, relay lists and every other list (the replaceable and addressable kinds), whoever wrote them;
- the notes the account bookmarked.
It goes through the store a page at a time, newest first from the moment given, and takes each page’s old events out in one go, so that what the relays send meanwhile is written between two pages rather than after the whole sweep.
flowchart TD
event["An event written before the limit"] --> mine{"Did the account write it?"}
mine -->|"yes"| stays["Stays"]
mine -->|"no"| kind{"Is there one of it for each person: replaceable, or addressable?"}
kind -->|"yes: a profile, a contact list, a relay list, an article"| stays
kind -->|"no: a note, a comment, a repost, a reaction, a zap receipt"| bookmarked{"Did the account bookmark it?"}
bookmarked -->|"yes"| stays
bookmarked -->|"no"| goes["Goes"]When a sweep runs, and what it waits for, is in
crate::handlers::store and crate::guide::flows.
Constants§
- PAGE 🔒
- How many events are looked at, and at most taken out, at a time.