I need to create a (hopefully) simple p2p network where all clients need to maintain a shared set of settings. Some of the things my network needs to do:
- Continuously update each peer's state
- Perform commands
- Fetch & distribute shared resources to all peers
While I do have some ideas on how to go about implementing this, I'm sure I'd just be reinventing the wheel. However, my Google-fu is too weak to be able to find a starting reference / term upon which to build further searches.
Please note that establishing peers is not an issue here: I have a central server with exact info on all peers involved and peers can query the server at will.
I believe my problem can be split to two or - simplified - only one problem:
- Maintain a global state where the peers have a way of knowing when they're out of sync
- (possibly already accomplished by #1) Determine the peer that will perform the next command
2 should be relatively easy given a synced global state: if there's a task to be performed, just mark it as taken, verify that all peers are notified and then perform it.
So the one real problem I have to solve is how to maintain a global state without making hundreds of IP requests to all peers for every change in the state. I mean, I know all peers HAVE to be notified, I was just hoping for an algorithm that would not require the origin peer to do it all itself. Also, some state changes could be detected by multiple peers at the same time and there probably exists something that solves such conflicts already.