Skip to content

ConsulBasedMembershipTable.UpdateRowAsync(MembershipEntry, string, TableVersion, CancellationToken)

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.