Skip to content

ZooKeeperBasedMembershipTable Methods

A Membership Table implementation using Apache Zookeeper 3.4.6 https://zookeeper.apache.org/doc/r3.4.6/

CleanupDefunctSiloEntries(DateTimeOffset)

View source
[System.Obsolete(Use CleanupDefunctSiloEntriesAsync instead.)]
public Task CleanupDefunctSiloEntries(DateTimeOffset beforeDate)
Removes dead silo entries whose last known update precedes beforeDate.

Parameters

beforeDateDateTimeOffset
The exclusive upper bound for the last known update time of entries to delete.

Returns

A task representing the cleanup operation.

CleanupDefunctSiloEntriesAsync(DateTimeOffset, CancellationToken)

View source
public Task CleanupDefunctSiloEntriesAsync(DateTimeOffset beforeDate, CancellationToken cancellationToken = default(CancellationToken))
Removes dead silo entries whose last known update precedes beforeDate.

Parameters

beforeDateDateTimeOffset
The exclusive upper bound for the last update time of entries to delete.
cancellationTokenCancellationToken
A token which cancels the operation.

Returns

A task representing the cleanup operation.

DeleteMembershipTableEntries(string)

View source
[System.Obsolete(Use DeleteMembershipTableEntriesAsync instead.)]
public Task DeleteMembershipTableEntries(string clusterId)
Deletes all table entries of the given clusterId

Parameters

clusterIdstring

DeleteMembershipTableEntriesAsync(string, CancellationToken)

View source
public Task DeleteMembershipTableEntriesAsync(string clusterId, CancellationToken cancellationToken = default(CancellationToken))
Deletes all table entries of the given clusterId

Parameters

clusterIdstring
The cluster whose entries are deleted.
cancellationTokenCancellationToken
A token which cancels the operation.

Returns

A task representing the deletion operation.

InitializeMembershipTable(bool)

View source
[System.Obsolete(Use InitializeMembershipTableAsync instead.)]
public Task InitializeMembershipTable(bool tryInitPath)
Initializes the ZooKeeper based membership table.

Parameters

tryInitPathbool
if set to true, we'll try to create a node named "/ClusterId"

InitializeMembershipTableAsync(bool, CancellationToken)

View source
public Task InitializeMembershipTableAsync(bool tryInitPath, CancellationToken cancellationToken = default(CancellationToken))
Initializes the membership table, will be called before all other methods

Parameters

tryInitPathbool
Whether to initialize the underlying table version.
cancellationTokenCancellationToken
A token which cancels the operation.

Returns

A task representing the initialization operation.

InsertRow(MembershipEntry, TableVersion)

View source
[System.Obsolete(Use InsertRowAsync instead.)]
public Task<bool> InsertRow(MembershipEntry entry, TableVersion 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: 1) New MembershipEntry will be added to the table. 2) The newly added MembershipEntry will also be added with the new unique automatically generated eTag. 3) TableVersion.Version in the table will be updated to the new TableVersion.Version. 4) TableVersion etag in the table will be updated to the new unique automatically generated eTag. All those changes to the table, insert of a new row and update of the table version and the associated etags, should happen atomically, or fail atomically with no side effects. The operation should fail in each of the following conditions: 1) A MembershipEntry for a given silo already exist in the table 2) Update of the TableVersion failed since the given TableVersion etag (as specified by the TableVersion.VersionEtag property) did not match the TableVersion etag in the table.

Parameters

entryMembershipEntry
MembershipEntry to be inserted.
tableVersionTableVersion
The new TableVersion for this table, along with its etag.

Returns

True if the insert operation succeeded and false otherwise.

Exceptions

System.ArgumentNullException
entry or tableVersion is null.

InsertRowAsync(MembershipEntry, TableVersion, CancellationToken)

View source
public Task<bool> InsertRowAsync(MembershipEntry entry, TableVersion tableVersion, CancellationToken cancellationToken = default(CancellationToken))
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: 1) New MembershipEntry will be added to the table. 2) The newly added MembershipEntry will have a provider-defined row eTag. 3) TableVersion.Version in the table will be updated to the new TableVersion.Version. 4) TableVersion etag in the table will be updated to the new unique automatically generated eTag. All those changes to the table, insert of a new row and update of the table version and the associated etags, should happen atomically, or fail atomically with no side effects. The operation should fail in each of the following conditions: 1) A MembershipEntry for a given silo already exist in the table 2) Update of the TableVersion failed since the given TableVersion etag (as specified by the TableVersion.VersionEtag property) did not match the TableVersion etag in the table.

Parameters

entryMembershipEntry
The membership entry to insert.
tableVersionTableVersion
The new table version and its expected etag.
cancellationTokenCancellationToken
A token which cancels the operation.

Returns

True if the insert operation succeeded and false otherwise.

ReadAll

View source
[System.Obsolete(Use ReadAllAsync instead.)]
public Task<MembershipTableData> 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.

Returns

The membership information for a given table: MembershipTableData consisting multiple MembershipEntry entries and TableVersion, all read atomically.

ReadAllAsync(CancellationToken)

View source
public Task<MembershipTableData> ReadAllAsync(CancellationToken cancellationToken = default(CancellationToken))
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.

Parameters

cancellationTokenCancellationToken
A token which cancels the operation.

Returns

The membership information for a given table: MembershipTableData consisting multiple MembershipEntry entries and TableVersion, all read atomically.

ReadRow(SiloAddress)

View source
[System.Obsolete(Use ReadRowAsync instead.)]
public Task<MembershipTableData> ReadRow(SiloAddress 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.

Parameters

siloAddressSiloAddress
The address of the silo whose membership information needs to be read.

Returns

The membership information for a given silo: MembershipTableData consisting one MembershipEntry entry and TableVersion, read atomically.

ReadRowAsync(SiloAddress, CancellationToken)

View source
public Task<MembershipTableData> ReadRowAsync(SiloAddress siloAddress, CancellationToken cancellationToken = default(CancellationToken))
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.

Parameters

siloAddressSiloAddress
The address of the silo to read.
cancellationTokenCancellationToken
A token which cancels the operation.

Returns

The membership information for a given silo: MembershipTableData consisting one MembershipEntry entry and TableVersion, read atomically.

UpdateIAmAlive(MembershipEntry)

View source
[System.Obsolete(Use UpdateIAmAliveAsync instead.)]
public Task UpdateIAmAlive(MembershipEntry entry)
Writes the owning silo's IAmAlive timestamp to its heartbeat node using one unconditional native update. The membership row and table version are preserved. Native storage failures propagate to the caller.

Parameters

entryMembershipEntry
The owning silo's membership entry containing its heartbeat timestamp.

Returns

Task representing the successful execution of this operation.

Exceptions

System.ArgumentNullException
entry is null.

UpdateIAmAliveAsync(MembershipEntry, CancellationToken)

View source
public Task UpdateIAmAliveAsync(MembershipEntry entry, CancellationToken cancellationToken = default(CancellationToken))
Updates the IAmAliveTime column of the MembershipEntry for this silo.

Parameters

entryMembershipEntry
The membership entry containing the updated liveness timestamp.
cancellationTokenCancellationToken
A token which cancels the operation.

Returns

A task representing the update operation.

UpdateRow(MembershipEntry, string, TableVersion)

View source
[System.Obsolete(Use UpdateRowAsync instead.)]
public Task<bool> UpdateRow(MembershipEntry entry, string etag, TableVersion 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: 1) The MembershipEntry for this silo will be updated to the new MembershipEntry (the old entry will be fully substituted by the new entry) 2) The eTag for the updated MembershipEntry will also be eTag with the new unique automatically generated eTag. 3) TableVersion.Version in the table will be updated to the new TableVersion.Version. 4) TableVersion etag in the table will be updated to the new unique automatically generated eTag. All those changes to the table, update of a new row and update of the table version and the associated etags, should happen atomically, or fail atomically with no side effects. The operation should fail in each of the following conditions: 1) A MembershipEntry for a given silo does not exist in the table 2) A MembershipEntry for a given silo exist in the table but its etag in the table does not match the provided etag. 3) Update of the TableVersion failed since the given TableVersion etag (as specified by the TableVersion.VersionEtag property) did not match the TableVersion etag in the table.

Parameters

entryMembershipEntry
MembershipEntry to be updated.
etagstring
The etag for the given MembershipEntry.
tableVersionTableVersion
The new TableVersion for this table, along with its etag.

Returns

True if the update operation succeeded and false otherwise.

Exceptions

System.ArgumentNullException
entry, etag, or tableVersion is null.

UpdateRowAsync(MembershipEntry, string, TableVersion, CancellationToken)

View source
public Task<bool> UpdateRowAsync(MembershipEntry entry, string etag, TableVersion tableVersion, CancellationToken cancellationToken = default(CancellationToken))
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: 1) The MembershipEntry for this silo will be updated using the supplied entry. 2) The row eTag for the updated MembershipEntry will reflect the provider's metadata or concurrency-token policy. 3) TableVersion.Version in the table will be updated to the new TableVersion.Version. 4) TableVersion etag in the table will be updated to the new unique automatically generated eTag. All those changes to the table, update of a new row and update of the table version and the associated etags, should happen atomically, or fail atomically with no side effects. The operation should fail in each of the following conditions: 1) A MembershipEntry for a given silo does not exist in the table 2) Update of the TableVersion failed since the given TableVersion etag (as specified by the TableVersion.VersionEtag property) did not match the TableVersion etag in the table. 3) The provider validates a separate canonical row concurrency token and the supplied etag does not match it.

Parameters

entryMembershipEntry
The membership entry to update.
etagstring
The provider-defined row entity tag obtained from a membership read.
tableVersionTableVersion
The new table version and its expected etag.
cancellationTokenCancellationToken
A token which cancels the operation.

Returns

True if the update operation succeeded and false otherwise.