Search in sources :

Example 1 with StartRequest

use of com.scalar.db.rpc.TransactionRequest.StartRequest in project scalardb by scalar-labs.

the class GrpcTransactionOnBidirectionalStream method startTransaction.

public String startTransaction(@Nullable String transactionId) throws TransactionException {
    throwIfTransactionFinished();
    StartRequest request;
    if (transactionId == null) {
        request = StartRequest.getDefaultInstance();
    } else {
        request = StartRequest.newBuilder().setTransactionId(transactionId).build();
    }
    ResponseOrError responseOrError = sendRequest(TransactionRequest.newBuilder().setStartRequest(request).build());
    throwIfErrorForStart(responseOrError);
    return responseOrError.getResponse().getStartResponse().getTransactionId();
}
Also used : StartRequest(com.scalar.db.rpc.TransactionRequest.StartRequest)

Aggregations

StartRequest (com.scalar.db.rpc.TransactionRequest.StartRequest)1