#moxie architecture is quite unconventional. it borrows a lot from Actor/CSP models, where there is hermetic isolation between threads, this is done in order to enforce clear memory ownership boundaries. each worker and each manager is an event queue, and they work according to whatever messages they receive, and send them wherever their processing says the results should be delivered. i was just thinking about the question "where should the signature checker thread live" and yes it should be attached to the database, that's what decides if it's valid to write to the database, and if it's valid then also that's where it gets bounced back to any open subscriptions.
so the database is like a librarian that is managing queries, i mean that's what a database is. the relay itself is something like this with extra appendages to handle transports but fundamentally a relay *is* a network connected database.
so it's turtles all the way down in moxie. whatever it looks like at network scale, it looks the same at application scale. one small distinction is that moxie's processes are a tree, not a graph. this is because each process is created by another, "parent" so it's inherently a phylogeny. i've thought about whether there should be the ability to do channels that bypass the parent but honestly, no. simply directing or copying a buffer across from one channel to forward to other channels is not a big job. the stem nodes, "manager" threads, are coordinators, and they also act as mailboxes. this is the Actor model part of the architecture. CSP doesn't assume a hierarchy but Actor does, for the reasons that if you don't have a clear relationship between the initiator of a new worker thread, or other manager, and its parent, who is responsible when the worker or other manager child crashes?
i suppose there could be some way to coordinate managing those buffers between leaves of the tree directly but i don't think it is as robust because then you complicate the taxonomy of the runtime's work. parent manages children. parent passes messages from one child to another according to the protocol and who does what.
