Expand description

The main type here is RelayPicker. You will need to implement RelayPickerHooks and then create a RelayPicker::new(hooks) with those hooks.

If you instantiate RelayPicker via Default::default(), for example in a lazy_static type setup, and then make changes which cause the Hooks to return something different than they did when they were created with Default::default() (e.g. global variable changes), then you might need to run RelayPicker::init() to reinitialize it with actual data.

Structs

  • This is a public key, which identifies an actor (usually a person) and is shared, as a hex string
  • A RelayAssignment is a record of a relay which is serving (or will serve) the general feed for a set of public keys.
  • The RelayPicker is a structure that helps assign people we follow to relays we watch. It remembers which publickeys are assigned to which relays, which pubkeys need more relays and how many, which relays need a time out, and person-relay scores for making good assignments dynamically.
  • A Url validated as a nostr relay url in canonical form We don’t serialize/deserialize these directly, see UncheckedUrl for that
  • An integer count of the number of seconds from 1st January 1970. This does not count any of the leap seconds that have occurred, it simply presumes UTC never had leap seconds; yet it is well known and well understood.

Enums

  • This is how a person uses a relay: to write (outbox) or to read (inbox)
  • Errors the RelayPicker functions can return

Traits

  • These are functions that need to be provided to the Relay Picker