use of io.pravega.shared.protocol.netty.WireCommands.GetTransactionInfo in project pravega by pravega.
the class PravegaRequestProcessor method getTransactionInfo.
@Override
public void getTransactionInfo(GetTransactionInfo request) {
String transactionName = StreamSegmentNameUtils.getTransactionNameFromId(request.getSegment(), request.getTxid());
if (!verifyToken(request.getSegment(), request.getRequestId(), request.getDelegationToken(), READ, "Get Transaction Info")) {
return;
}
segmentStore.getStreamSegmentInfo(transactionName, false, TIMEOUT).thenAccept(properties -> {
if (properties != null) {
TransactionInfo result = new TransactionInfo(request.getRequestId(), request.getSegment(), request.getTxid(), transactionName, !properties.isDeleted(), properties.isSealed(), properties.getLastModified().getTime(), properties.getLength());
log.trace("Read transaction segment info: {}", result);
connection.send(result);
} else {
log.trace("getTransactionInfo could not find segment {}", transactionName);
connection.send(new TransactionInfo(request.getRequestId(), request.getSegment(), request.getTxid(), transactionName, false, true, 0, 0));
}
}).exceptionally(e -> handleException(request.getRequestId(), transactionName, "Get transaction info", e));
}
Aggregations