Relays are a data structure
Discussion
...with shared structure...but different records/datasets...?
Uh I guess...except we assume a note may be censored from any given relay but exist on any other given relay.
I'm a lover of memoization, but at the same time let's not forget why the NOSTR RSS like relay structure exists
i don't think data structures have this kind of trade-off anyway. usually it's one simple structure (eg, signed integer), 5-10, a larger compound structure, made out of the simple structures, another 5-20 functions.
at least in my experience, data structure to method ratio is fairly consistent, slightly increasing with the complexity of the structure.
also considering the scope of transcendentals with floating point numbers, you got you 100 functions for a simple 64 bit data structure right there if you add in all the stuff hiding in infix and prefix and postfix operators.
i'd go so far as to say that this is a complete red herring because the purpose of a data structure dictates how many functions it needs. a large data structure often needs accessors to control access and/or prevent race conditions.
and then there's also the fact that accessing large data structures tends to be wrapped in FIFO pipes and/or network interfaces, and you can aggregate many of these into one application. Just go look at a typical web service API for an example of one data structure with hundreds of methods.
not meaning to nitpick exactly but data and methods to operate on it isn't really quantifiable in this way.
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.