Skip to main content

Module outbox

Module outbox 

Source
Expand description

Where people’s events are: their relay lists (NIP-65), and which of the relays those name are worth asking.

Someone’s relay list (kind 10002) says where they write, which is where their notes are to be read, and where they read, which is where what is meant for them is to be sent. Reading the people an account follows from the relays they write to, rather than from the account’s own alone, is what finds the notes of those who write elsewhere (the outbox model).

Everyone names several relays and everyone’s differ, so asking all of them would be a connection to half the network. plan picks few: the relays that between them have the most people, so many for each person and so many in all, counting the account’s own relays, which are asked anyway, as the ones they are.

What a relay list names is somebody else’s word, as is the relay the address of a note names, and is not connected to without a look: see public.

flowchart TD
    start["Everyone is short of so many relays, less those of the account's own they list"] --> best["Of the relays not yet taken: which helps the most people who are still short?"]
    best --> any{"Does any help anyone?"}
    any -->|"no"| done["Done"]
    any -->|"yes"| take["Take it. Everyone who lists it is short of one fewer"]
    take --> cap{"As many taken as may be?"}
    cap -->|"yes"| done
    cap -->|"no"| best

A worked example of a plan, and the rest of what is decided about relays, is in crate::guide::relays.

Structs§

Whereabouts
What is known of where a note is, beside that it may be on the account’s own relays: what whoever named the note said of it.

Enums§

Listed
Which of the relays someone lists are meant.

Functions§

plan
The relays to ask about the people in listed, beside the account’s own, and whom to ask each about: a relay is asked about everyone who lists it.
public
Whether relay, which somebody else names (in their relay list, or in the address of a note), is one to connect to: on the open internet, and encrypted.
relays
The relays the relay list list names for listed, each once, in the list’s order. A relay named without saying which it is for is for both.
to_let_go
Which of the relays in the pool of other people’s to take out of it. pooled is each with how long it has gone unused. Those unused for keep or longer go; and if more than cap are left, the ones used longest ago go too, but none used within busy, which may be in the middle of answering.