C# Class FoundationDB.Layers.Counters.FdbHighContentionCounter

Represents an integer value which can be incremented without conflict. Uses a sharded representation (which scales with contention) along with background coalescing...
This is obsoleted for most practical purposes by the addition of atomic to FoundationDB v2.x, which do the same thing more efficiently.
Exibir arquivo Open project: BedeGaming/foundationdb-dotnet-client

Public Methods

Method Description
Add ( IFdbTransaction trans, long x ) : void

Add the value x to the counter.

AddAsync ( long x, CancellationToken cancellationToken ) : Task

Add the value x to the counter.

FdbHighContentionCounter ( IFdbDatabase db, FdbSubspace subspace ) : FoundationDB.Client

Create a new High Contention counter.

FdbHighContentionCounter ( IFdbDatabase db, FdbSubspace subspace, IValueEncoder encoder ) : FoundationDB.Client

Create a new High Contention counter, using a specific value encoder.

GetSnapshot ( IFdbReadOnlyTransaction trans ) : Task

Get the value of the counter with snapshot isolation (no transaction conflicts).

GetSnapshotAsync ( CancellationToken cancellationToken ) : Task

Get the value of the counter with snapshot isolation (no transaction conflicts).

GetTransactional ( IFdbReadOnlyTransaction trans ) : Task

Get the value of the counter. Not recommended for use with read/write transactions when the counter is being frequently updated (conflicts will be very likely).

GetTransactionalAsync ( CancellationToken cancellationToken ) : Task

Get the value of the counter. Not recommended for use with read/write transactions when the counter is being frequently updated (conflicts will be very likely).

SetTotal ( IFdbTransaction trans, long x ) : Task

Set the counter to value x.

SetTotalAsync ( long x, CancellationToken cancellationToken ) : Task

Set the counter to value x.

Protected Methods

Method Description
RandomId ( ) : Slice

Generate a new random slice

Private Methods

Method Description
BackgroundCoalesce ( int n, CancellationToken ct ) : void
Coalesce ( int N, CancellationToken ct ) : Task

Method Details

Add() public method

Add the value x to the counter.
public Add ( IFdbTransaction trans, long x ) : void
trans IFdbTransaction
x long
return void

AddAsync() public method

Add the value x to the counter.
public AddAsync ( long x, CancellationToken cancellationToken ) : Task
x long
cancellationToken System.Threading.CancellationToken
return Task

FdbHighContentionCounter() public method

Create a new High Contention counter.
public FdbHighContentionCounter ( IFdbDatabase db, FdbSubspace subspace ) : FoundationDB.Client
db IFdbDatabase Database used by this layer
subspace FdbSubspace Subspace to be used for storing the counter
return FoundationDB.Client

FdbHighContentionCounter() public method

Create a new High Contention counter, using a specific value encoder.
public FdbHighContentionCounter ( IFdbDatabase db, FdbSubspace subspace, IValueEncoder encoder ) : FoundationDB.Client
db IFdbDatabase Database used by this layer
subspace FdbSubspace Subspace to be used for storing the counter
encoder IValueEncoder Encoder for the counter values
return FoundationDB.Client

GetSnapshot() public method

Get the value of the counter with snapshot isolation (no transaction conflicts).
public GetSnapshot ( IFdbReadOnlyTransaction trans ) : Task
trans IFdbReadOnlyTransaction
return Task

GetSnapshotAsync() public method

Get the value of the counter with snapshot isolation (no transaction conflicts).
public GetSnapshotAsync ( CancellationToken cancellationToken ) : Task
cancellationToken System.Threading.CancellationToken
return Task

GetTransactional() public method

Get the value of the counter. Not recommended for use with read/write transactions when the counter is being frequently updated (conflicts will be very likely).
public GetTransactional ( IFdbReadOnlyTransaction trans ) : Task
trans IFdbReadOnlyTransaction
return Task

GetTransactionalAsync() public method

Get the value of the counter. Not recommended for use with read/write transactions when the counter is being frequently updated (conflicts will be very likely).
public GetTransactionalAsync ( CancellationToken cancellationToken ) : Task
cancellationToken System.Threading.CancellationToken
return Task

RandomId() protected method

Generate a new random slice
protected RandomId ( ) : Slice
return Slice

SetTotal() public method

Set the counter to value x.
public SetTotal ( IFdbTransaction trans, long x ) : Task
trans IFdbTransaction
x long
return Task

SetTotalAsync() public method

Set the counter to value x.
public SetTotalAsync ( long x, CancellationToken cancellationToken ) : Task
x long
cancellationToken System.Threading.CancellationToken
return Task