public abstract class BigtableClient
BigtableServiceApi client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.Bigtable.V2Assembly
Google.Cloud.Bigtable.V2.dll
Remarks
Service for reading from and writing to existing Bigtable tables.
Properties
AppProfileId
public virtual string AppProfileId { get; }
Gets the value which specifies routing for replication. If null or empty, the "default" application profile will be used by the server.
Property Value | |
---|---|
Type | Description |
String |
Methods
CheckAndMutateRow(TableName, BigtableByteString, RowFilter, Mutation[])
public virtual CheckAndMutateRowResponse CheckAndMutateRow(TableName tableName, BigtableByteString rowKey, RowFilter predicateFilter, params Mutation[] trueMutations)
Mutates a row atomically based on the output of a predicate Reader filter.
Parameters | |
---|---|
Name | Description |
tableName | TableName The unique name of the table to which the conditional mutation should be applied. Must not be null. |
rowKey | BigtableByteString The key of the row to which the conditional mutation should be applied. Must not be empty. |
predicateFilter | RowFilter The filter to be applied to the contents of the specified row. Depending
on whether or not any results are yielded, |
trueMutations | Mutation[] Changes to be atomically applied to the specified row if |
Returns | |
---|---|
Type | Description |
CheckAndMutateRowResponse | The response from trying to mutate the row. |
Note that string is implicitly convertible to BigtableByteString, so rowKey
can
be specified using a string as well and its UTF-8 representations will be used.
This method simply delegates to CheckAndMutateRow(CheckAndMutateRowRequest, CallSettings).
CheckAndMutateRow(TableName, BigtableByteString, RowFilter, IEnumerable<Mutation>, IEnumerable<Mutation>, CallSettings)
public virtual CheckAndMutateRowResponse CheckAndMutateRow(TableName tableName, BigtableByteString rowKey, RowFilter predicateFilter, IEnumerable<Mutation> trueMutations, IEnumerable<Mutation> falseMutations, CallSettings callSettings = null)
Mutates a row atomically based on the output of a predicate Reader filter.
Parameters | |
---|---|
Name | Description |
tableName | TableName The unique name of the table to which the conditional mutation should be applied. Must not be null. |
rowKey | BigtableByteString The key of the row to which the conditional mutation should be applied. Must not be empty. |
predicateFilter | RowFilter The filter to be applied to the contents of the specified row. Depending
on whether or not any results are yielded, either |
trueMutations | IEnumerable<Mutation> Changes to be atomically applied to the specified row if |
falseMutations | IEnumerable<Mutation> Changes to be atomically applied to the specified row if |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
CheckAndMutateRowResponse | The response from trying to mutate the row. |
Note that string is implicitly convertible to BigtableByteString, so rowKey
can
be specified using a string as well and its UTF-8 representations will be used.
This method simply delegates to CheckAndMutateRow(CheckAndMutateRowRequest, CallSettings).
CheckAndMutateRow(CheckAndMutateRowRequest, CallSettings)
public virtual CheckAndMutateRowResponse CheckAndMutateRow(CheckAndMutateRowRequest request, CallSettings callSettings = null)
Mutates a row atomically based on the output of a predicate Reader filter.
Parameters | |
---|---|
Name | Description |
request | CheckAndMutateRowRequest The request object containing all of the parameters for the API call. If the AppProfileId has not been specified, it will be initialized from the value stored in the client. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
CheckAndMutateRowResponse | The RPC response. |
CheckAndMutateRowAsync(TableName, BigtableByteString, RowFilter, Mutation[])
public virtual Task<CheckAndMutateRowResponse> CheckAndMutateRowAsync(TableName tableName, BigtableByteString rowKey, RowFilter predicateFilter, params Mutation[] trueMutations)
Asynchronously mutates a row atomically based on the output of a predicate Reader filter.
Parameters | |
---|---|
Name | Description |
tableName | TableName The unique name of the table to which the conditional mutation should be applied. Must not be null. |
rowKey | BigtableByteString The key of the row to which the conditional mutation should be applied. Must not be empty. |
predicateFilter | RowFilter The filter to be applied to the contents of the specified row. Depending
on whether or not any results are yielded, |
trueMutations | Mutation[] Changes to be atomically applied to the specified row if |
Returns | |
---|---|
Type | Description |
Task<CheckAndMutateRowResponse> | The response from trying to mutate the row. |
Note that string is implicitly convertible to BigtableByteString, so rowKey
can
be specified using a string as well and its UTF-8 representations will be used.
This method simply delegates to CheckAndMutateRowAsync(CheckAndMutateRowRequest, CallSettings).
CheckAndMutateRowResponse response = await client.CheckAndMutateRowAsync(
new TableName(projectId, instanceId, tableId),
"user12345",
// If the latest value in the "Address:Country" column is "USA"...
RowFilters.Chain(
RowFilters.FamilyNameExact("Address"),
RowFilters.ColumnQualifierExact("Country"),
RowFilters.CellsPerColumnLimit(1),
RowFilters.ValueExact("USA")),
// ...remove all previous Level 1 scores and set the value to 0.
Mutations.DeleteFromColumn("Score", "Level 1"),
Mutations.SetCell("Score", "Level 1", 0, new BigtableVersion(1)));
if (response.PredicateMatched)
{
Console.WriteLine("The level 1 scores have been reset");
}
else
{
Console.WriteLine("The level 1 scores were not modified.");
}
CheckAndMutateRowAsync(TableName, BigtableByteString, RowFilter, IEnumerable<Mutation>, IEnumerable<Mutation>, CallSettings)
public virtual Task<CheckAndMutateRowResponse> CheckAndMutateRowAsync(TableName tableName, BigtableByteString rowKey, RowFilter predicateFilter, IEnumerable<Mutation> trueMutations, IEnumerable<Mutation> falseMutations, CallSettings callSettings = null)
Asynchronously mutates a row atomically based on the output of a predicate Reader filter.
Parameters | |
---|---|
Name | Description |
tableName | TableName The unique name of the table to which the conditional mutation should be applied. Must not be null. |
rowKey | BigtableByteString The key of the row to which the conditional mutation should be applied. Must not be empty. |
predicateFilter | RowFilter The filter to be applied to the contents of the specified row. Depending
on whether or not any results are yielded, either |
trueMutations | IEnumerable<Mutation> Changes to be atomically applied to the specified row if |
falseMutations | IEnumerable<Mutation> Changes to be atomically applied to the specified row if |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<CheckAndMutateRowResponse> | The response from trying to mutate the row. |
Note that string is implicitly convertible to BigtableByteString, so rowKey
can
be specified using a string as well and its UTF-8 representations will be used.
This method simply delegates to CheckAndMutateRowAsync(CheckAndMutateRowRequest, CallSettings).
CheckAndMutateRowAsync(CheckAndMutateRowRequest, CallSettings)
public virtual Task<CheckAndMutateRowResponse> CheckAndMutateRowAsync(CheckAndMutateRowRequest request, CallSettings callSettings = null)
Mutates a row atomically based on the output of a predicate Reader filter.
Parameters | |
---|---|
Name | Description |
request | CheckAndMutateRowRequest The request object containing all of the parameters for the API call. If the AppProfileId has not been specified, it will be initialized from the value stored in the client. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<CheckAndMutateRowResponse> | A Task containing the RPC response. |
CheckAndMutateRowAsync(CheckAndMutateRowRequest, CancellationToken)
public virtual Task<CheckAndMutateRowResponse> CheckAndMutateRowAsync(CheckAndMutateRowRequest request, CancellationToken cancellationToken)
Mutates a row atomically based on the output of a predicate Reader filter.
Parameters | |
---|---|
Name | Description |
request | CheckAndMutateRowRequest The request object containing all of the parameters for the API call. If the AppProfileId has not been specified, it will be initialized from the value stored in the client. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<CheckAndMutateRowResponse> | A Task containing the RPC response. |
Create()
public static BigtableClient Create()
Synchronously creates a BigtableClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use BigtableClientBuilder.
Returns | |
---|---|
Type | Description |
BigtableClient | The created BigtableServiceApiClient. |
Create(BigtableServiceApiClient)
public static BigtableClient Create(BigtableServiceApiClient client)
Synchronously creates a BigtableClient from a pre-existing API client.
Parameter | |
---|---|
Name | Description |
client | BigtableServiceApiClient The BigtableServiceApiClient to use in the BigtableClient. Must not be null. |
Returns | |
---|---|
Type | Description |
BigtableClient | The created BigtableClient. |
CreateAsync()
public static Task<BigtableClient> CreateAsync()
Asynchronously creates a BigtableClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use BigtableClientBuilder.
Returns | |
---|---|
Type | Description |
Task<BigtableClient> | The created BigtableServiceApiClient. |
MutateRow(TableName, BigtableByteString, Mutation[])
public virtual MutateRowResponse MutateRow(TableName tableName, BigtableByteString rowKey, params Mutation[] mutations)
Mutates a row atomically. Cells already present in the row are left
unchanged unless explicitly changed by mutations
.
Parameters | |
---|---|
Name | Description |
tableName | TableName The unique name of the table to which the mutation should be applied. Must not be null. |
rowKey | BigtableByteString The key of the row to which the mutation should be applied. Must not be empty. |
mutations | Mutation[] Changes to be atomically applied to the specified row. Entries are applied in order, meaning that earlier mutations can be masked by later ones. Must contain at least one entry and at most 100000. Must not be null, or contain null elements. |
Returns | |
---|---|
Type | Description |
MutateRowResponse | The response from mutating the row. |
Note that string is implicitly convertible to BigtableByteString, so rowKey
can
be specified using a string as well and its UTF-8 representations will be used.
This method simply delegates to MutateRow(MutateRowRequest, CallSettings).
MutateRow(TableName, BigtableByteString, IEnumerable<Mutation>, CallSettings)
public virtual MutateRowResponse MutateRow(TableName tableName, BigtableByteString rowKey, IEnumerable<Mutation> mutations, CallSettings callSettings = null)
Mutates a row atomically. Cells already present in the row are left
unchanged unless explicitly changed by mutations
.
Parameters | |
---|---|
Name | Description |
tableName | TableName The unique name of the table to which the mutation should be applied. Must not be null. |
rowKey | BigtableByteString The key of the row to which the mutation should be applied. Must not be empty. |
mutations | IEnumerable<Mutation> Changes to be atomically applied to the specified row. Entries are applied in order, meaning that earlier mutations can be masked by later ones. Must contain at least one entry and at most 100000. Must not be null, or contain null elements. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
MutateRowResponse | The response from mutating the row. |
Note that string is implicitly convertible to BigtableByteString, so rowKey
can
be specified using a string as well and its UTF-8 representations will be used.
This method simply delegates to MutateRow(MutateRowRequest, CallSettings).
MutateRow(MutateRowRequest, CallSettings)
public virtual MutateRowResponse MutateRow(MutateRowRequest request, CallSettings callSettings = null)
Mutates a row atomically. Cells already present in the row are left
unchanged unless explicitly changed by mutation
.
Parameters | |
---|---|
Name | Description |
request | MutateRowRequest The request object containing all of the parameters for the API call. If the AppProfileId has not been specified, it will be initialized from the value stored in the client. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
MutateRowResponse | The RPC response. |
MutateRowAsync(TableName, BigtableByteString, Mutation[])
public virtual Task<MutateRowResponse> MutateRowAsync(TableName tableName, BigtableByteString rowKey, params Mutation[] mutations)
Asynchronously mutates a row atomically. Cells already present in the row are left
unchanged unless explicitly changed by mutations
.
Parameters | |
---|---|
Name | Description |
tableName | TableName The unique name of the table to which the mutation should be applied. Must not be null. |
rowKey | BigtableByteString The key of the row to which the mutation should be applied. Must not be empty. |
mutations | Mutation[] Changes to be atomically applied to the specified row. Entries are applied in order, meaning that earlier mutations can be masked by later ones. Must contain at least one entry and at most 100000. Must not be null, or contain null elements. |
Returns | |
---|---|
Type | Description |
Task<MutateRowResponse> | The response from mutating the row. |
Note that string is implicitly convertible to BigtableByteString, so rowKey
can
be specified using a string as well and its UTF-8 representations will be used.
This method simply delegates to MutateRowAsync(MutateRowRequest, CallSettings).
await client.MutateRowAsync(
new TableName(projectId, instanceId, tableId),
// From the row with key '0xABCD1234'...
new byte[] { 0xAB, 0xCD, 0x12, 0x34 },
// delete all cells from the column family "Address",
Mutations.DeleteFromFamily("Address"),
// and all cells from the "Score:Level 1" column which are older than a day (assuming UTC
// timestamp micros have been used as version values in this column).
Mutations.DeleteFromColumn(
"Score",
"Level 1",
new BigtableVersionRange(null, DateTime.UtcNow.AddDays(-1))));
MutateRowAsync(TableName, BigtableByteString, IEnumerable<Mutation>, CallSettings)
public virtual Task<MutateRowResponse> MutateRowAsync(TableName tableName, BigtableByteString rowKey, IEnumerable<Mutation> mutations, CallSettings callSettings = null)
Asynchronously mutates a row atomically. Cells already present in the row are left
unchanged unless explicitly changed by mutations
.
Parameters | |
---|---|
Name | Description |
tableName | TableName The unique name of the table to which the mutation should be applied. Must not be null. |
rowKey | BigtableByteString The key of the row to which the mutation should be applied. Must not be empty. |
mutations | IEnumerable<Mutation> Changes to be atomically applied to the specified row. Entries are applied in order, meaning that earlier mutations can be masked by later ones. Must contain at least one entry and at most 100000. Must not be null, or contain null elements. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<MutateRowResponse> | The response from mutating the row. |
Note that string is implicitly convertible to BigtableByteString, so rowKey
can
be specified using a string as well and its UTF-8 representations will be used.
This method simply delegates to MutateRowAsync(MutateRowRequest, CallSettings).
MutateRowAsync(MutateRowRequest, CallSettings)
public virtual Task<MutateRowResponse> MutateRowAsync(MutateRowRequest request, CallSettings callSettings = null)
Mutates a row atomically. Cells already present in the row are left
unchanged unless explicitly changed by mutation
.
Parameters | |
---|---|
Name | Description |
request | MutateRowRequest The request object containing all of the parameters for the API call. If the AppProfileId has not been specified, it will be initialized from the value stored in the client. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<MutateRowResponse> | A Task containing the RPC response. |
MutateRowAsync(MutateRowRequest, CancellationToken)
public virtual Task<MutateRowResponse> MutateRowAsync(MutateRowRequest request, CancellationToken cancellationToken)
Mutates a row atomically. Cells already present in the row are left
unchanged unless explicitly changed by mutation
.
Parameters | |
---|---|
Name | Description |
request | MutateRowRequest The request object containing all of the parameters for the API call. If the AppProfileId has not been specified, it will be initialized from the value stored in the client. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<MutateRowResponse> | A Task containing the RPC response. |
MutateRows(TableName, MutateRowsRequest.Types.Entry[])
public virtual MutateRowsResponse MutateRows(TableName tableName, params MutateRowsRequest.Types.Entry[] entries)
Mutates multiple rows in a batch. Each individual row is mutated atomically as in MutateRow(MutateRowRequest, CallSettings), but the entire batch is not executed atomically.
Parameters | |
---|---|
Name | Description |
tableName | TableName The unique name of the table to which the mutations should be applied. Must not be null. |
entries | MutateRowsRequest.Types.Entry[] The row keys and corresponding mutations to be applied in bulk. Each entry is applied as an atomic mutation, but the entries may be applied in arbitrary order (even between entries for the same row). At least one entry must be specified, and in total the entries can contain at most 100000 mutations. |
Returns | |
---|---|
Type | Description |
MutateRowsResponse | The response from mutating the rows. |
This method simply delegates to MutateRows(TableName, IEnumerable<MutateRowsRequest.Types.Entry>, CallSettings).
MutateRows(TableName, IEnumerable<MutateRowsRequest.Types.Entry>, CallSettings)
public virtual MutateRowsResponse MutateRows(TableName tableName, IEnumerable<MutateRowsRequest.Types.Entry> entries, CallSettings callSettings = null)
Mutates multiple rows in a batch. Each individual row is mutated atomically as in MutateRow(MutateRowRequest, CallSettings), but the entire batch is not executed atomically.
Parameters | |
---|---|
Name | Description |
tableName | TableName The unique name of the table to which the mutations should be applied. Must not be null. |
entries | IEnumerable<MutateRowsRequest.Types.Entry> The row keys and corresponding mutations to be applied in bulk. Each entry is applied as an atomic mutation, but the entries may be applied in arbitrary order (even between entries for the same row). At least one entry must be specified, and in total the entries can contain at most 100000 mutations. Must not be null, or contain null elements. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
MutateRowsResponse | The response from mutating the rows. |
This method simply delegates to MutateRows(MutateRowsRequest, CallSettings).
MutateRows(MutateRowsRequest, CallSettings)
public virtual MutateRowsResponse MutateRows(MutateRowsRequest request, CallSettings callSettings = null)
Mutates multiple rows in a batch. Each individual row is mutated atomically as in MutateRow, but the entire batch is not executed atomically.
Parameters | |
---|---|
Name | Description |
request | MutateRowsRequest The request object containing all of the parameters for the API call. If the AppProfileId has not been specified, it will be initialized from the value stored in the client. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
MutateRowsResponse | The RPC response. |
MutateRowsAsync(TableName, MutateRowsRequest.Types.Entry[])
public virtual Task<MutateRowsResponse> MutateRowsAsync(TableName tableName, params MutateRowsRequest.Types.Entry[] entries)
Mutates multiple rows in a batch. Each individual row is mutated atomically as in MutateRow(MutateRowRequest, CallSettings), but the entire batch is not executed atomically.
Parameters | |
---|---|
Name | Description |
tableName | TableName The unique name of the table to which the mutations should be applied. Must not be null. |
entries | MutateRowsRequest.Types.Entry[] The row keys and corresponding mutations to be applied in bulk. Each entry is applied as an atomic mutation, but the entries may be applied in arbitrary order (even between entries for the same row). At least one entry must be specified, and in total the entries can contain at most 100000 mutations. |
Returns | |
---|---|
Type | Description |
Task<MutateRowsResponse> | The response from mutating the rows. |
This method simply delegates to MutateRowsAsync(TableName, IEnumerable<MutateRowsRequest.Types.Entry>, CallSettings).
MutateRowsResponse response = await client.MutateRowsAsync(
new TableName(projectId, instanceId, tableId),
// From row 'user12345'...
Mutations.CreateEntry("user12345",
// delete all cells from the column family "Score",
Mutations.DeleteFromFamily("Score"),
// and all cells from the "metrics:clicks" column which are older than a day (assuming UTC
// timestamp micros have been used as version values in this column).
Mutations.DeleteFromColumn(
"metrics",
"clicks",
new BigtableVersionRange(null, DateTime.UtcNow.AddDays(-1)))),
// Delete all data from row 'user23456'
Mutations.CreateEntry("user23456", Mutations.DeleteFromRow()));
foreach (MutateRowsResponse.Types.Entry entry in response.Entries)
{
switch (entry.Index)
{
case 0:
Console.WriteLine($"The mutations to row 'user12345' finished with status code {entry.Status.Code}");
break;
case 1:
Console.WriteLine($"The mutations to row 'user23456' finished with status code {entry.Status.Code}");
break;
default:
throw new ArgumentOutOfRangeException();
}
}
MutateRowsAsync(TableName, IEnumerable<MutateRowsRequest.Types.Entry>, CallSettings)
public virtual Task<MutateRowsResponse> MutateRowsAsync(TableName tableName, IEnumerable<MutateRowsRequest.Types.Entry> entries, CallSettings callSettings = null)
Mutates multiple rows in a batch. Each individual row is mutated atomically as in MutateRow(MutateRowRequest, CallSettings), but the entire batch is not executed atomically.
Parameters | |
---|---|
Name | Description |
tableName | TableName The unique name of the table to which the mutations should be applied. Must not be null. |
entries | IEnumerable<MutateRowsRequest.Types.Entry> The row keys and corresponding mutations to be applied in bulk. Each entry is applied as an atomic mutation, but the entries may be applied in arbitrary order (even between entries for the same row). At least one entry must be specified, and in total the entries can contain at most 100000 mutations. Must not be null, or contain null elements. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<MutateRowsResponse> | The response from mutating the rows. |
This method simply delegates to MutateRowsAsync(MutateRowsRequest, CallSettings).
MutateRowsAsync(MutateRowsRequest, CallSettings)
public virtual Task<MutateRowsResponse> MutateRowsAsync(MutateRowsRequest request, CallSettings callSettings = null)
Mutates multiple rows in a batch. Each individual row is mutated atomically as in MutateRow, but the entire batch is not executed atomically.
Parameters | |
---|---|
Name | Description |
request | MutateRowsRequest The request object containing all of the parameters for the API call. If the AppProfileId has not been specified, it will be initialized from the value stored in the client. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<MutateRowsResponse> | The RPC response. |
MutateRowsAsync(MutateRowsRequest, CancellationToken)
public virtual Task<MutateRowsResponse> MutateRowsAsync(MutateRowsRequest request, CancellationToken cancellationToken)
Mutates multiple rows in a batch. Each individual row is mutated atomically as in MutateRow, but the entire batch is not executed atomically.
Parameters | |
---|---|
Name | Description |
request | MutateRowsRequest The request object containing all of the parameters for the API call. If the AppProfileId has not been specified, it will be initialized from the value stored in the client. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<MutateRowsResponse> | The RPC response. |
ReadModifyWriteRow(TableName, BigtableByteString, ReadModifyWriteRule[])
public virtual ReadModifyWriteRowResponse ReadModifyWriteRow(TableName tableName, BigtableByteString rowKey, params ReadModifyWriteRule[] rules)
Modifies a row atomically on the server. The method reads the latest existing version and value from the specified columns and writes a new entry based on pre-defined read/modify/write rules. The new value for the version is the greater of the previous value's version or the current server version. The method returns the new contents of all modified cells.
Parameters | |
---|---|
Name | Description |
tableName | TableName The unique name of the table to which the read/modify/write rules should be applied. Must not be null. |
rowKey | BigtableByteString The key of the row to which the read/modify/write rules should be applied. Must not be empty. |
rules | ReadModifyWriteRule[] Rules specifying how the specified row's contents are to be transformed into writes. Entries are applied in order, meaning that earlier rules will affect the results of later ones. Must not be null, or contain null elements. |
Returns | |
---|---|
Type | Description |
ReadModifyWriteRowResponse | The response from modifying the row. |
Note that the server version is based on the current timestamp since the Unix epoch, so for columns which are updated using ReadModifyWriteRow, other reads and writes of those columns should use BigtableVersion values constructed from DateTime values, as opposed to using a custom versioning scheme with 64-bit values.
Note that string is implicitly convertible to BigtableByteString, so rowKey
can
be specified using a string as well and its UTF-8 representations will be used.
This method simply delegates to ReadModifyWriteRow(ReadModifyWriteRowRequest, CallSettings).
ReadModifyWriteRow(TableName, BigtableByteString, IEnumerable<ReadModifyWriteRule>, CallSettings)
public virtual ReadModifyWriteRowResponse ReadModifyWriteRow(TableName tableName, BigtableByteString rowKey, IEnumerable<ReadModifyWriteRule> rules, CallSettings callSettings = null)
Modifies a row atomically on the server. The method reads the latest existing version and value from the specified columns and writes a new entry based on pre-defined read/modify/write rules. The new value for the version is the greater of the previous value's version or the current server version. The method returns the new contents of all modified cells.
Parameters | |
---|---|
Name | Description |
tableName | TableName The unique name of the table to which the read/modify/write rules should be applied. Must not be null. |
rowKey | BigtableByteString The key of the row to which the read/modify/write rules should be applied. Must not be empty. |
rules | IEnumerable<ReadModifyWriteRule> Rules specifying how the specified row's contents are to be transformed into writes. Entries are applied in order, meaning that earlier rules will affect the results of later ones. Must not be null, or contain null elements. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
ReadModifyWriteRowResponse | The response from modifying the row. |
Note that the server version is based on the current timestamp since the Unix epoch, so for columns which are updated using ReadModifyWriteRow, other reads and writes of those columns should use BigtableVersion values constructed from DateTime values, as opposed to using a custom versioning scheme with 64-bit values.
Note that string is implicitly convertible to BigtableByteString, so rowKey
can
be specified using a string as well and its UTF-8 representations will be used.
This method simply delegates to ReadModifyWriteRow(ReadModifyWriteRowRequest, CallSettings).
ReadModifyWriteRow(ReadModifyWriteRowRequest, CallSettings)
public virtual ReadModifyWriteRowResponse ReadModifyWriteRow(ReadModifyWriteRowRequest request, CallSettings callSettings = null)
Modifies a row atomically on the server. The method reads the latest existing timestamp and value from the specified columns and writes a new entry based on pre-defined read/modify/write rules. The new value for the timestamp is the greater of the existing timestamp or the current server time. The method returns the new contents of all modified cells.
Parameters | |
---|---|
Name | Description |
request | ReadModifyWriteRowRequest The request object containing all of the parameters for the API call. If the AppProfileId has not been specified, it will be initialized from the value stored in the client. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
ReadModifyWriteRowResponse | The RPC response. |
ReadModifyWriteRowAsync(TableName, BigtableByteString, ReadModifyWriteRule[])
public virtual Task<ReadModifyWriteRowResponse> ReadModifyWriteRowAsync(TableName tableName, BigtableByteString rowKey, params ReadModifyWriteRule[] rules)
Asynchronously modifies a row atomically on the server. The method reads the latest existing version and value from the specified columns and writes a new entry based on pre-defined read/modify/write rules. The new value for the version is the greater of the previous value's version or the current server version. The method returns the new contents of all modified cells.
Parameters | |
---|---|
Name | Description |
tableName | TableName The unique name of the table to which the read/modify/write rules should be applied. Must not be null. |
rowKey | BigtableByteString The key of the row to which the read/modify/write rules should be applied. Must not be empty. |
rules | ReadModifyWriteRule[] Rules specifying how the specified row's contents are to be transformed into writes. Entries are applied in order, meaning that earlier rules will affect the results of later ones. Must not be null, or contain null elements. |
Returns | |
---|---|
Type | Description |
Task<ReadModifyWriteRowResponse> | The response from modifying the row. |
Note that the server version is based on the current timestamp since the Unix epoch, so for columns which are updated using ReadModifyWriteRow, other reads and writes of those columns should use BigtableVersion values constructed from DateTime values, as opposed to using a custom versioning scheme with 64-bit values.
Note that string is implicitly convertible to BigtableByteString, so rowKey
can
be specified using a string as well and its UTF-8 representations will be used.
This method simply delegates to ReadModifyWriteRowAsync(ReadModifyWriteRowRequest, CallSettings).
// Increase the value of the cell with the "Level 1" qualifier in the
// "Score" column family by 55.
ReadModifyWriteRowResponse response = await client.ReadModifyWriteRowAsync(
new TableName(projectId, instanceId, tableId),
"user12345",
ReadModifyWriteRules.Increment("Score", "Level 1", 55));
Cell modifiedCell = response.Row.Families[0].Columns[0].Cells[0];
// Implicitly convert the ByteString Value into a BigtableByteString,
// which supports additional conversions specific to Bigtable.
BigtableByteString value = modifiedCell.Value;
// Convert the BigtableByteString to a long to obtain the updated value.
long newScore = (long) value;
Console.WriteLine($"The total score for level 1 is now {newScore}");
ReadModifyWriteRowAsync(TableName, BigtableByteString, IEnumerable<ReadModifyWriteRule>, CallSettings)
public virtual Task<ReadModifyWriteRowResponse> ReadModifyWriteRowAsync(TableName tableName, BigtableByteString rowKey, IEnumerable<ReadModifyWriteRule> rules, CallSettings callSettings = null)
Asynchronously modifies a row atomically on the server. The method reads the latest existing version and value from the specified columns and writes a new entry based on pre-defined read/modify/write rules. The new value for the version is the greater of the previous value's version or the current server version. The method returns the new contents of all modified cells.
Parameters | |
---|---|
Name | Description |
tableName | TableName The unique name of the table to which the read/modify/write rules should be applied. Must not be null. |
rowKey | BigtableByteString The key of the row to which the read/modify/write rules should be applied. Must not be empty. |
rules | IEnumerable<ReadModifyWriteRule> Rules specifying how the specified row's contents are to be transformed into writes. Entries are applied in order, meaning that earlier rules will affect the results of later ones. Must not be null, or contain null elements. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<ReadModifyWriteRowResponse> | The response from modifying the row. |
Note that the server version is based on the current timestamp since the Unix epoch, so for columns which are updated using ReadModifyWriteRow, other reads and writes of those columns should use BigtableVersion values constructed from DateTime values, as opposed to using a custom versioning scheme with 64-bit values.
Note that string is implicitly convertible to BigtableByteString, so rowKey
can
be specified using a string as well and its UTF-8 representations will be used.
This method simply delegates to ReadModifyWriteRowAsync(ReadModifyWriteRowRequest, CallSettings).
ReadModifyWriteRowAsync(ReadModifyWriteRowRequest, CallSettings)
public virtual Task<ReadModifyWriteRowResponse> ReadModifyWriteRowAsync(ReadModifyWriteRowRequest request, CallSettings callSettings = null)
Modifies a row atomically on the server. The method reads the latest existing timestamp and value from the specified columns and writes a new entry based on pre-defined read/modify/write rules. The new value for the timestamp is the greater of the existing timestamp or the current server time. The method returns the new contents of all modified cells.
Parameters | |
---|---|
Name | Description |
request | ReadModifyWriteRowRequest The request object containing all of the parameters for the API call. If the AppProfileId has not been specified, it will be initialized from the value stored in the client. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<ReadModifyWriteRowResponse> | A Task containing the RPC response. |
ReadModifyWriteRowAsync(ReadModifyWriteRowRequest, CancellationToken)
public virtual Task<ReadModifyWriteRowResponse> ReadModifyWriteRowAsync(ReadModifyWriteRowRequest request, CancellationToken cancellationToken)
Modifies a row atomically on the server. The method reads the latest existing timestamp and value from the specified columns and writes a new entry based on pre-defined read/modify/write rules. The new value for the timestamp is the greater of the existing timestamp or the current server time. The method returns the new contents of all modified cells.
Parameters | |
---|---|
Name | Description |
request | ReadModifyWriteRowRequest The request object containing all of the parameters for the API call. If the AppProfileId has not been specified, it will be initialized from the value stored in the client. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<ReadModifyWriteRowResponse> | A Task containing the RPC response. |
ReadRow(TableName, BigtableByteString, RowFilter, CallSettings)
public virtual Row ReadRow(TableName tableName, BigtableByteString rowKey, RowFilter filter = null, CallSettings callSettings = null)
Returns the contents of the requested row, optionally applying the specified Reader filter.
Parameters | |
---|---|
Name | Description |
tableName | TableName The unique name of the table from which to read. Must not be null. |
rowKey | BigtableByteString The key of the row to read. Must not be empty. |
filter | RowFilter The filter to apply to the contents of the specified row. If null, reads the entirety of the row. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Row | The row from the server or null if it does not exist. |
This method simply delegates to ReadRowAsync(TableName, BigtableByteString, RowFilter, CallSettings).
ReadRowAsync(TableName, BigtableByteString, RowFilter, CallSettings)
public virtual Task<Row> ReadRowAsync(TableName tableName, BigtableByteString rowKey, RowFilter filter = null, CallSettings callSettings = null)
Asynchronously returns the contents of the requested row, optionally applying the specified Reader filter.
Parameters | |
---|---|
Name | Description |
tableName | TableName The unique name of the table from which to read. Must not be null. |
rowKey | BigtableByteString The key of the row to read. Must not be empty. |
filter | RowFilter The filter to apply to the contents of the specified row. If null, reads the entirety of the row. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Row> | The row from the server or null if it does not exist. |
This method simply delegates to ReadRows(TableName, RowSet, RowFilter, Nullable<Int64>, CallSettings) and takes the single row result or null if no rows are returned.
// Only read cells from the "Line X" columns, where X is some
// digit, in the Address column family and only take the most
// recent cell from each column.
Row row = await client.ReadRowAsync(
new TableName(projectId, instanceId, tableId),
"user12345",
RowFilters.Chain(
RowFilters.FamilyNameExact("Address"),
RowFilters.ColumnQualifierRegex(@"Line \d"),
RowFilters.CellsPerColumnLimit(1)),
CallSettings.FromCancellationToken(cancellationToken));
Family addressFamily = row.Families.FirstOrDefault();
if (addressFamily != null)
{
foreach (Column column in addressFamily.Columns)
{
Console.WriteLine($" Column qualifier: {column.Qualifier.ToStringUtf8()}");
foreach (Cell cell in column.Cells)
{
Console.WriteLine($" Cell value: {cell.Value.ToStringUtf8()}");
Console.WriteLine($" Timestamp: {cell.Version.ToDateTime()}");
Console.WriteLine($" Labels: {string.Join(", ", cell.Labels)}");
}
}
}
ReadRows(TableName, RowSet, RowFilter, Nullable<Int64>, CallSettings)
public virtual ReadRowsStream ReadRows(TableName tableName, RowSet rows = null, RowFilter filter = null, long? rowsLimit = default(long? ), CallSettings callSettings = null)
Streams back the contents of all requested rows in key order, optionally applying the same Reader filter to each.
Parameters | |
---|---|
Name | Description |
tableName | TableName The unique name of the table from which to read. Must not be null. |
rows | RowSet The row keys and/or ranges to read. If null, reads from all rows. |
filter | RowFilter The filter to apply to the contents of the specified row(s). If null, reads the entirety of each row. |
rowsLimit | Nullable<Int64> The read will terminate after committing to N rows' worth of results. If null or 0, returns all results. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
ReadRowsStream | The server stream. |
This method simply delegates to ReadRows(ReadRowsRequest, CallSettings).
TableName tableName = new TableName(projectId, instanceId, tableId);
// Read rows whose keys are greater than or equal to 'user00000'
// and less than 'user99999'.
RowSet rows = RowSet.FromRowRanges(
RowRange.ClosedOpen("user00000", "user99999"));
// Only read cells from the "Address" column family and only take the most recent cell from each column.
RowFilter filter = RowFilters.Chain(
RowFilters.FamilyNameExact("Address"),
RowFilters.CellsPerColumnLimit(1));
// Just read the first 10 rows.
long rowsLimit = 10;
// Make the request
ReadRowsStream streamingResponse = client.ReadRows(
tableName,
rows,
filter,
rowsLimit,
CallSettings.FromCancellationToken(cancellationToken));
// Read streaming responses from server until complete
await streamingResponse.ForEachAsync(row =>
{
Console.WriteLine($"Row key: {row.Key.ToStringUtf8()}");
foreach (Family family in row.Families)
{
Console.WriteLine($" Family name: {family.Name}");
foreach (Column column in family.Columns)
{
Console.WriteLine($" Column qualifier: {column.Qualifier.ToStringUtf8()}");
foreach (Cell cell in column.Cells)
{
Console.WriteLine($" Cell value: {cell.Value.ToStringUtf8()}");
Console.WriteLine($" Timestamp: {cell.Version.ToDateTime()}");
Console.WriteLine($" Labels: {string.Join(", ", cell.Labels)}");
}
}
}
});
ReadRows(ReadRowsRequest, CallSettings)
public virtual ReadRowsStream ReadRows(ReadRowsRequest request, CallSettings callSettings = null)
Streams back the contents of all requested rows in key order, optionally applying the same Reader filter to each.
Parameters | |
---|---|
Name | Description |
request | ReadRowsRequest The request object containing all of the parameters for the API call. If the AppProfileId has not been specified, it will be initialized from the value stored in the client. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
ReadRowsStream | The server stream. |
SampleRowKeys(TableName, CallSettings)
public virtual BigtableServiceApiClient.SampleRowKeysStream SampleRowKeys(TableName tableName, CallSettings callSettings = null)
Returns a sample of row keys in the table. The returned row keys will delimit contiguous sections of the table of approximately equal size, which can be used to break up the data for distributed tasks like mapreduces.
Parameters | |
---|---|
Name | Description |
tableName | TableName Required. The unique name of the table from which to sample row keys.
Values are of the form
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
BigtableServiceApiClient.SampleRowKeysStream | The server stream. |
BigtableServiceApiClient.SampleRowKeysStream streamingResponse = client.SampleRowKeys(
new TableName(projectId, instanceId, tableId),
CallSettings.FromCancellationToken(cancellationToken));
// Get all streaming responses from server in a list so they can be easily iterated.
IList<SampleRowKeysResponse> rowKeySamples =
await streamingResponse.ToListAsync(cancellationToken);
long previousRowOffsetBytes = 0;
foreach (SampleRowKeysResponse rowKeySample in rowKeySamples)
{
// The OffsetBytes are non-decreasing, so their difference should always be 0 or more.
long offsetDifference = rowKeySample.OffsetBytes - previousRowOffsetBytes;
Console.WriteLine($"Row key: {rowKeySample.RowKey.ToStringUtf8()}, at offset {rowKeySample.OffsetBytes}");
Console.WriteLine($" Approximate bytes since previous row sample: {offsetDifference}");
previousRowOffsetBytes = rowKeySample.OffsetBytes;
}
SampleRowKeys(TableName, String, CallSettings)
public virtual BigtableServiceApiClient.SampleRowKeysStream SampleRowKeys(TableName tableName, string appProfileId, CallSettings callSettings = null)
Returns a sample of row keys in the table. The returned row keys will delimit contiguous sections of the table of approximately equal size, which can be used to break up the data for distributed tasks like mapreduces.
Parameters | |
---|---|
Name | Description |
tableName | TableName Required. The unique name of the table from which to sample row keys.
Values are of the form
|
appProfileId | String This value specifies routing for replication. If not specified, the "default" application profile will be used. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
BigtableServiceApiClient.SampleRowKeysStream | The server stream. |
SampleRowKeys(SampleRowKeysRequest, CallSettings)
public virtual BigtableServiceApiClient.SampleRowKeysStream SampleRowKeys(SampleRowKeysRequest request, CallSettings callSettings = null)
Returns a sample of row keys in the table. The returned row keys will delimit contiguous sections of the table of approximately equal size, which can be used to break up the data for distributed tasks like mapreduces.
Parameters | |
---|---|
Name | Description |
request | SampleRowKeysRequest The request object containing all of the parameters for the API call. If the AppProfileId has not been specified, it will be initialized from the value stored in the client. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
BigtableServiceApiClient.SampleRowKeysStream | The server stream. |
SampleRowKeys(String, CallSettings)
public virtual BigtableServiceApiClient.SampleRowKeysStream SampleRowKeys(string tableName, CallSettings callSettings = null)
Returns a sample of row keys in the table. The returned row keys will delimit contiguous sections of the table of approximately equal size, which can be used to break up the data for distributed tasks like mapreduces.
Parameters | |
---|---|
Name | Description |
tableName | String Required. The unique name of the table from which to sample row keys.
Values are of the form
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
BigtableServiceApiClient.SampleRowKeysStream | The server stream. |
SampleRowKeys(String, String, CallSettings)
public virtual BigtableServiceApiClient.SampleRowKeysStream SampleRowKeys(string tableName, string appProfileId, CallSettings callSettings = null)
Returns a sample of row keys in the table. The returned row keys will delimit contiguous sections of the table of approximately equal size, which can be used to break up the data for distributed tasks like mapreduces.
Parameters | |
---|---|
Name | Description |
tableName | String Required. The unique name of the table from which to sample row keys.
Values are of the form
|
appProfileId | String This value specifies routing for replication. If not specified, the "default" application profile will be used. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
BigtableServiceApiClient.SampleRowKeysStream | The server stream. |