Tutorial on nano-discord / distributed pub-sub in Rust?

At a high level, at most once delivery pub-sub looks like

HashMap<Channel, HashSet<Clients>>

We can approximate a nano-discord as a "distributed/multi-machine pub-sub" + "logger" (for message history).

Is there any tutorial on building such a "nano discord" in Rust (or language that easily translates to Rust?). Googling = results on building discord/slack bots.

Thanks!

PS; If you know of a crate with similar functionality, that would be helpful too.

The mini-redis implements pub-sub functionality, and since it is intended to be a learning resource, the code should be easy to understand. The Tokio tutorial is based on mini-redis.

I've actually written a distributed pub-sub server just last summer. Is there anything in particular you would like to know?

Let us say we have server machines S1, S2, S3, ..., SN.

Let us say that ClientA is connected to S1 and ClientB is connected to S2. Suppose both are in 'rust' channel.

  1. How is the 'HashMap<Channel, HashSet>' split/synchronized over S1, S2, ..., SN ? Do all servers store everyhing (and we use Raft/Paxos protocol, or is the HashMap sharded so each server only stores a part of the HashMap) ?

  2. Let is track the life of a single message. ClientA sends 'rust' 'hello'; ClientB eventually receives 'hello' from channel 'rust' -- what happens in between?

Sorry, this was not obvious to me from skimming the README -- is mini-redis server side one machine or a cluster ? It's the "distributed" part of pubsub that I want to learn more about.

Sorry, I had missed the distributed part of your question.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.