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();
}
Aggregations