Search in sources :

Example 1 with ReadModifyWriteRowResponse

use of com.google.bigtable.v2.ReadModifyWriteRowResponse in project java-bigtable by googleapis.

the class EnhancedBigtableStub method createReadModifyWriteRowCallable.

/**
 * Creates a callable chain to handle ReadModifyWriteRow RPCs. The chain will:
 *
 * <ul>
 *   <li>Convert {@link ReadModifyWriteRow}s into {@link
 *       com.google.bigtable.v2.ReadModifyWriteRowRequest}s.
 *   <li>Convert the responses into {@link Row}.
 *   <li>Add tracing & metrics.
 * </ul>
 */
private UnaryCallable<ReadModifyWriteRow, Row> createReadModifyWriteRowCallable() {
    UnaryCallable<ReadModifyWriteRowRequest, ReadModifyWriteRowResponse> base = GrpcRawCallableFactory.createUnaryCallable(GrpcCallSettings.<ReadModifyWriteRowRequest, ReadModifyWriteRowResponse>newBuilder().setMethodDescriptor(BigtableGrpc.getReadModifyWriteRowMethod()).setParamsExtractor(new RequestParamsExtractor<ReadModifyWriteRowRequest>() {

        @Override
        public Map<String, String> extract(ReadModifyWriteRowRequest request) {
            return ImmutableMap.of("table_name", request.getTableName(), "app_profile_id", request.getAppProfileId());
        }
    }).build(), settings.readModifyWriteRowSettings().getRetryableCodes());
    UnaryCallable<ReadModifyWriteRowRequest, ReadModifyWriteRowResponse> withStatsHeaders = new StatsHeadersUnaryCallable<>(base);
    String methodName = "ReadModifyWriteRow";
    UnaryCallable<ReadModifyWriteRowRequest, ReadModifyWriteRowResponse> withHeaderTracer = new HeaderTracerUnaryCallable<>(withStatsHeaders);
    UnaryCallable<ReadModifyWriteRowRequest, ReadModifyWriteRowResponse> retrying = Callables.retrying(withHeaderTracer, settings.readModifyWriteRowSettings(), clientContext);
    return createUserFacingUnaryCallable(methodName, new ReadModifyWriteRowCallable(retrying, requestContext));
}
Also used : HeaderTracerUnaryCallable(com.google.cloud.bigtable.data.v2.stub.metrics.HeaderTracerUnaryCallable) ReadModifyWriteRowRequest(com.google.bigtable.v2.ReadModifyWriteRowRequest) StatsHeadersUnaryCallable(com.google.cloud.bigtable.data.v2.stub.metrics.StatsHeadersUnaryCallable) ByteString(com.google.protobuf.ByteString) ReadModifyWriteRowResponse(com.google.bigtable.v2.ReadModifyWriteRowResponse) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap)

Aggregations

ReadModifyWriteRowRequest (com.google.bigtable.v2.ReadModifyWriteRowRequest)1 ReadModifyWriteRowResponse (com.google.bigtable.v2.ReadModifyWriteRowResponse)1 HeaderTracerUnaryCallable (com.google.cloud.bigtable.data.v2.stub.metrics.HeaderTracerUnaryCallable)1 StatsHeadersUnaryCallable (com.google.cloud.bigtable.data.v2.stub.metrics.StatsHeadersUnaryCallable)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ByteString (com.google.protobuf.ByteString)1 Map (java.util.Map)1