-
Notifications
You must be signed in to change notification settings - Fork 0
Architecture
The following diagram is a high-level static representation of NRV. The responsibilities of the important classes are defined below.

Contains services and nodes that have memberships into those services. Each node can have 0 to n membership per service, making it possible for a node to handle more than one section of the consistent hashing ring.
Manages nodes membership to services and the status of each membership (Up, Down, Joining, Leaving). The cluster manager can be static (StaticClusterManager), which gives a static view of the cluster in which all nodes are always up, or dynamic (ZookeeperClusterManager), which uses Zookeeper to maintain a consistent view of the cluster among nodes. StaticClusterManager does not depend on ZooKeeper, and is generally used for testing.
A service is a set of Actions that can be remotely called. Actions are executed on remote (or local) node defined by the token associated with the query. Enddestinationss (destinations) are resolved by the Resolver. In NRV, the service would be the host (http://service/path).
An action is a function that can be executed on a service. In a REST URL, the action is the path (http://service/path). In the previous diagram, MyService registers its actions and will redirect incoming queries to appropriate action by searching for an action matching the requested path.
Actions use the Resolver to find on which node a request should be sent. In the context of replication, other implementations of the Resolver are used by the slaves to locate masters.
Actions use a protocol to send a request to remote nodes. The protocol alone doesn't know how to encode requests, it uses a Codec to encode messages over the protocol. For instance, over the HTTP protocol, the JSON codec could be used to encode the message's data. This sequence diagram provides more information on message exchange and other implicated classes.
A consistency implementation manages the consistency, availability and partition tolerance of the distributed service. Since it's impossible for a distributed system to provide more than 2 of those 3 guarantees, a service can define the consistency that it wants to use for its actions. For instance, for a database, the ConsistencyMasterSlave implementation (along with a sub system) makes it possible to manage the consistency and the availability of the cluster, but won't be able to resist to a network partition. The exact behavior of ConsistencyMasterSlave is described in details in the replication article.