ZooKeeperBasedMembershipTable Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A Membership Table implementation using Apache Zookeeper 3.4.6 https://zookeeper.apache.org/doc/r3.4.6/
public class ZooKeeperBasedMembershipTable : Orleans.IMembershipTable, Orleans.Messaging.IGatewayListProvider
type ZooKeeperBasedMembershipTable = class
interface IMembershipTable
interface IGatewayListProvider
Public Class ZooKeeperBasedMembershipTable
Implements IGatewayListProvider, IMembershipTable
- Inheritance
-
ZooKeeperBasedMembershipTable
- Implements
Remarks
A brief overview of ZK features used: The data is represented by a tree of nodes (similar to a file system). Every node is addressed by a path and can hold data as a byte array and has a version. When a node is created, its version is 0. Upon updates, the version is atomically incremented. An update can also be conditional on an expected current version. A transaction can hold several operations, which succeed or fail atomically. when creating a zookeeper client, one can set a base path where all operations are relative to.
In this implementation: Every Orleans deployment has a node /UniqueDeploymentId Every Silo's state is saved in /UniqueDeploymentId/IP:Port@Gen Every Silo's IAmAlive is saved in /UniqueDeploymentId/IP:Port@Gen/IAmAlive IAmAlive is saved in a separate node because its updates are unconditional.
a node's ZK version is its ETag: the table version is the version of /UniqueDeploymentId the silo entry version is the version of /UniqueDeploymentId/IP:Port@Gen
Constructors
ZooKeeperBasedMembershipTable() |
Properties
IsUpdatable |
Specifies whether this IGatewayListProvider ever refreshes its returned infomation, or always returns the same gw list. (currently only the static config based StaticGatewayListProvider is not updatable. All others are.) |
MaxStaleness |
Specifies how often this IGatewayListProvider is refreshed, to have a bound on max staleness of its returned infomation. |
Methods
DeleteMembershipTableEntries(String) |
Deletes all table entries of the given deploymentId |
GetGateways() |
Returns the list of gateways (silos) that can be used by a client to connect to Orleans cluster. The Uri is in the form of: "gwy.tcp://IP:port/Generation". See Utils.ToGatewayUri and Utils.ToSiloAddress for more details about Uri format. |
InitializeGatewayListProvider(ClientConfiguration, Logger) |
Initializes the ZooKeeper based gateway provider |
InitializeMembershipTable(GlobalConfiguration, Boolean, Logger) |
Initializes the ZooKeeper based membership table. |
InsertRow(MembershipEntry, TableVersion) |
Atomically tries to insert (add) a new MembershipEntry for one silo and also update the TableVersion. If operation succeeds, the following changes would be made to the table:
|
ReadAll() |
Atomically reads the full content of the Membership Table. The returned MembershipTableData includes all MembershipEntry entry for all silos in the table and the TableVersion for this table. The MembershipEntries and the TableVersion have to be read atomically. |
ReadRow(SiloAddress) |
Atomically reads the Membership Table information about a given silo. The returned MembershipTableData includes one MembershipEntry entry for a given silo and the TableVersion for this table. The MembershipEntry and the TableVersion have to be read atomically. |
UpdateIAmAlive(MembershipEntry) |
Updates the IAmAlive part (column) of the MembershipEntry for this silo. This operation should only update the IAmAlive collumn and not change other columns. This operation is a "dirty write" or "in place update" and is performed without etag validation. With regards to eTags update: This operation may automatically update the eTag associated with the given silo row, but it does not have to. It can also leave the etag not changed ("dirty write"). With regards to TableVersion: this operation should not change the TableVersion of the table. It should leave it untouched. There is no scenario where this operation could fail due to table semantical reasons. It can only fail due to network problems or table unavailability. |
UpdateRow(MembershipEntry, String, TableVersion) |
Atomically tries to update the MembershipEntry for one silo and also update the TableVersion. If operation succeeds, the following changes would be made to the table:
|