Skip to main content

Crate gossip_relay_picker

Crate gossip_relay_picker 

Source
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§

PublicKeyHex
This is a public key, which identifies an actor (usually a person) and is shared, as a hex string
RelayAssignment
A RelayAssignment is a record of a relay which is serving (or will serve) the general feed for a set of public keys.
RelayPicker
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.
RelayUrl
A Url validated as a nostr relay url in canonical form We don’t serialize/deserialize these directly, see UncheckedUrl for that
Unixtime
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§

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

Traits§

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