Here's what I'm thinking. Relays aren't really a data structure, they're actually a minimal object wrapper around collections of events, which are. Relays have four methods:
- AUTH sets internal state
- EVENT writes an event, may use AUTH state
- REQ reads events, may use AUTH state
- negentropy sync generates metadata for use with REQ
The relay may be stateful, but the set of events a relay holds isn't, in the sense that an event id or hash of event ids is referentially transparent. If you can extract events from a set of relays, you have access to that dataset in theory (you might need to keep a local cache or something).
An infinite number of functions may be applied to a set of events:
- Count
- Search
- Filter
- Recommend
- Sort
- Trending
- Top zaps
- Top likes
- WoT score
- Export to file
- Import from file
- Find spam
- Omit spam
Very few of these functions should be relay methods. They should instead be functions provided externally to the relay interface by centralized servers, clients, or DVMs.