use of io.pravega.shared.protocol.netty.WireCommands.CreateTransaction in project pravega by pravega.
the class PravegaRequestProcessor method createTransaction.
@Override
public void createTransaction(CreateTransaction createTransaction) {
if (!verifyToken(createStreamSegment.getName(), createTransaction.getRequestId(), createTransaction.getDelegationToken(), READ_UPDATE, "Create Transaction")) {
return;
}
Collection<AttributeUpdate> attributes = Collections.singleton(new AttributeUpdate(CREATION_TIME, AttributeUpdateType.None, System.currentTimeMillis()));
log.debug("Creating transaction {} ", createTransaction);
long requestId = createTransaction.getRequestId();
segmentStore.createTransaction(createTransaction.getSegment(), createTransaction.getTxid(), attributes, TIMEOUT).thenAccept(txName -> connection.send(new TransactionCreated(requestId, createTransaction.getSegment(), createTransaction.getTxid()))).exceptionally(e -> handleException(requestId, createTransaction.getSegment(), "Create transaction", e));
}
Aggregations