Search in sources :

Example 91 with Mutation

use of com.google.spanner.v1.Mutation in project gapic-generator-java by googleapis.

the class SyncCheckAndMutateRowStringBytestringRowfilterListmutationListmutationString method syncCheckAndMutateRowStringBytestringRowfilterListmutationListmutationString.

public static void syncCheckAndMutateRowStringBytestringRowfilterListmutationListmutationString() throws Exception {
    // It may require modifications to work in your environment.
    try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
        String tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
        ByteString rowKey = ByteString.EMPTY;
        RowFilter predicateFilter = RowFilter.newBuilder().build();
        List<Mutation> trueMutations = new ArrayList<>();
        List<Mutation> falseMutations = new ArrayList<>();
        String appProfileId = "appProfileId704923523";
        CheckAndMutateRowResponse response = baseBigtableDataClient.checkAndMutateRow(tableName, rowKey, predicateFilter, trueMutations, falseMutations, appProfileId);
    }
}
Also used : RowFilter(com.google.bigtable.v2.RowFilter) ByteString(com.google.protobuf.ByteString) ArrayList(java.util.ArrayList) CheckAndMutateRowResponse(com.google.bigtable.v2.CheckAndMutateRowResponse) ByteString(com.google.protobuf.ByteString) Mutation(com.google.bigtable.v2.Mutation) BaseBigtableDataClient(com.google.cloud.bigtable.data.v2.BaseBigtableDataClient)

Example 92 with Mutation

use of com.google.spanner.v1.Mutation in project gapic-generator-java by googleapis.

the class SyncCheckAndMutateRowTablenameBytestringRowfilterListmutationListmutation method syncCheckAndMutateRowTablenameBytestringRowfilterListmutationListmutation.

public static void syncCheckAndMutateRowTablenameBytestringRowfilterListmutationListmutation() throws Exception {
    // It may require modifications to work in your environment.
    try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
        TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
        ByteString rowKey = ByteString.EMPTY;
        RowFilter predicateFilter = RowFilter.newBuilder().build();
        List<Mutation> trueMutations = new ArrayList<>();
        List<Mutation> falseMutations = new ArrayList<>();
        CheckAndMutateRowResponse response = baseBigtableDataClient.checkAndMutateRow(tableName, rowKey, predicateFilter, trueMutations, falseMutations);
    }
}
Also used : TableName(com.google.bigtable.v2.TableName) RowFilter(com.google.bigtable.v2.RowFilter) ByteString(com.google.protobuf.ByteString) ArrayList(java.util.ArrayList) CheckAndMutateRowResponse(com.google.bigtable.v2.CheckAndMutateRowResponse) Mutation(com.google.bigtable.v2.Mutation) BaseBigtableDataClient(com.google.cloud.bigtable.data.v2.BaseBigtableDataClient)

Example 93 with Mutation

use of com.google.spanner.v1.Mutation in project gapic-generator-java by googleapis.

the class SyncCheckAndMutateRowTablenameBytestringRowfilterListmutationListmutationString method syncCheckAndMutateRowTablenameBytestringRowfilterListmutationListmutationString.

public static void syncCheckAndMutateRowTablenameBytestringRowfilterListmutationListmutationString() throws Exception {
    // It may require modifications to work in your environment.
    try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
        TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
        ByteString rowKey = ByteString.EMPTY;
        RowFilter predicateFilter = RowFilter.newBuilder().build();
        List<Mutation> trueMutations = new ArrayList<>();
        List<Mutation> falseMutations = new ArrayList<>();
        String appProfileId = "appProfileId704923523";
        CheckAndMutateRowResponse response = baseBigtableDataClient.checkAndMutateRow(tableName, rowKey, predicateFilter, trueMutations, falseMutations, appProfileId);
    }
}
Also used : TableName(com.google.bigtable.v2.TableName) RowFilter(com.google.bigtable.v2.RowFilter) ByteString(com.google.protobuf.ByteString) ArrayList(java.util.ArrayList) CheckAndMutateRowResponse(com.google.bigtable.v2.CheckAndMutateRowResponse) Mutation(com.google.bigtable.v2.Mutation) ByteString(com.google.protobuf.ByteString) BaseBigtableDataClient(com.google.cloud.bigtable.data.v2.BaseBigtableDataClient)

Example 94 with Mutation

use of com.google.spanner.v1.Mutation in project gapic-generator-java by googleapis.

the class SyncMutateRowTablenameBytestringListmutation method syncMutateRowTablenameBytestringListmutation.

public static void syncMutateRowTablenameBytestringListmutation() throws Exception {
    // It may require modifications to work in your environment.
    try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
        TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
        ByteString rowKey = ByteString.EMPTY;
        List<Mutation> mutations = new ArrayList<>();
        MutateRowResponse response = baseBigtableDataClient.mutateRow(tableName, rowKey, mutations);
    }
}
Also used : TableName(com.google.bigtable.v2.TableName) MutateRowResponse(com.google.bigtable.v2.MutateRowResponse) ByteString(com.google.protobuf.ByteString) ArrayList(java.util.ArrayList) Mutation(com.google.bigtable.v2.Mutation) BaseBigtableDataClient(com.google.cloud.bigtable.data.v2.BaseBigtableDataClient)

Example 95 with Mutation

use of com.google.spanner.v1.Mutation in project grpc-gcp-java by GoogleCloudPlatform.

the class DataStoreChecksumClient method commitTransaction.

private static void commitTransaction(DatastoreBlockingStub stub, String projectId) {
    int transactionBytes = 2000;
    String payload = new String(new char[transactionBytes]).replace('\0', 'x');
    Key key = Key.newBuilder().addPath(PathElement.newBuilder().setKind("Data").setName("data1").build()).build();
    Entity entity = Entity.newBuilder().setKey(key).putProperties("2kb", Value.newBuilder().setExcludeFromIndexes(true).setStringValue(payload).build()).build();
    Mutation mutation = Mutation.newBuilder().setUpdate(entity).build();
    CommitRequest commitRequest = CommitRequest.newBuilder().setProjectId(projectId).setMode(Mode.NON_TRANSACTIONAL).addMutations(mutation).build();
    CommitResponse commitResponse = stub.commit(commitRequest);
    System.out.println("index updates: " + commitResponse.getIndexUpdates());
}
Also used : CommitRequest(com.google.datastore.v1.CommitRequest) Entity(com.google.datastore.v1.Entity) CommitResponse(com.google.datastore.v1.CommitResponse) Mutation(com.google.datastore.v1.Mutation) Key(com.google.datastore.v1.Key)

Aggregations

Test (org.junit.Test)70 Mutation (com.google.bigtable.v2.Mutation)62 ArrayList (java.util.ArrayList)59 ByteString (com.google.protobuf.ByteString)56 CommitRequest (com.google.spanner.v1.CommitRequest)15 KV (org.apache.beam.sdk.values.KV)15 CheckAndMutateRowResponse (com.google.bigtable.v2.CheckAndMutateRowResponse)14 AbstractMessage (com.google.protobuf.AbstractMessage)13 InvalidArgumentException (com.google.api.gax.rpc.InvalidArgumentException)12 RowFilter (com.google.bigtable.v2.RowFilter)12 TableName (com.google.bigtable.v2.TableName)12 StatusRuntimeException (io.grpc.StatusRuntimeException)12 CheckAndMutateRowRequest (com.google.bigtable.v2.CheckAndMutateRowRequest)11 MutateRowRequest (com.google.bigtable.v2.MutateRowRequest)11 Mutation (com.google.spanner.v1.Mutation)11 BaseBigtableDataClient (com.google.cloud.bigtable.data.v2.BaseBigtableDataClient)10 MutateRowResponse (com.google.bigtable.v2.MutateRowResponse)9 SetCell (com.google.bigtable.v2.Mutation.SetCell)9 Mutation (com.google.datastore.v1.Mutation)9 CommitResponse (com.google.spanner.v1.CommitResponse)9