These are chat archives for atomix/atomix
onStateChangemethod is almost identical to how state changes occur in ZooKeeper clients. The state change is really just an indicator of the health of the client's session and its ability to communicate with servers. But Copycat/Atomix does have something very similar to ZooKeeper's watches but with a few more guarantees. Atomix is made up of a bunch of Copycat state machines. Copycat state machines and clients have an abstraction similar to watches called session events. Session events can be used by the state machine to send any kind of notification to a client. For example, in the case of
DistributedGroup, the state machine sends an event whenever a member joins the group or a leader change occurs. ZooKeeper's watches are sort of low level primitives on which patterns can be built. But session events are a more customizable version of watches that help build higher level notifications for specific state machines and specific use cases. They work in almost exactly the same way as watches. The server to which the client is connected sends the event to the client, and events are guaranteed to be received in sequential order. But they have stronger guarantees in that Copycat replicates session events, so if a client switches servers and misses an event, the server to which the client connects will have the event and will re-send it to the client. Furthermore, clients don't typically need to reregister after receiving an event, though that's really up to the state machine implementation.