Search in sources :

Example 6 with ResendBatchResponse

use of com.quorum.tessera.recovery.resend.ResendBatchResponse in project tessera by ConsenSys.

the class TransactionResource method resendBatch.

@Operation(summary = "/resendBatch", operationId = "requestPayloadBatchResend", description = "initiate resend of all transactions for a given public key in batches")
@ApiResponse(responseCode = "200", description = "count of total transactions being resent", content = @Content(schema = @Schema(implementation = com.quorum.tessera.p2p.recovery.ResendBatchResponse.class)))
@POST
@Path("resendBatch")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
public Response resendBatch(@Valid @NotNull final ResendBatchRequest resendBatchRequest) {
    LOGGER.debug("Received resend request");
    final com.quorum.tessera.recovery.resend.ResendBatchRequest request = com.quorum.tessera.recovery.resend.ResendBatchRequest.Builder.create().withPublicKey(resendBatchRequest.getPublicKey()).withBatchSize(resendBatchRequest.getBatchSize()).build();
    final ResendBatchResponse response = batchResendManager.resendBatch(request);
    final com.quorum.tessera.p2p.recovery.ResendBatchResponse responseEntity = new com.quorum.tessera.p2p.recovery.ResendBatchResponse();
    responseEntity.setTotal(response.getTotal());
    final Response.ResponseBuilder builder = Response.status(Response.Status.OK);
    builder.entity(responseEntity);
    return builder.build();
}
Also used : Response(jakarta.ws.rs.core.Response) ApiResponse(io.swagger.v3.oas.annotations.responses.ApiResponse) ResendBatchResponse(com.quorum.tessera.recovery.resend.ResendBatchResponse) ResendBatchResponse(com.quorum.tessera.recovery.resend.ResendBatchResponse) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponse(io.swagger.v3.oas.annotations.responses.ApiResponse)

Aggregations

ResendBatchResponse (com.quorum.tessera.recovery.resend.ResendBatchResponse)6 EncryptedTransactionDAO (com.quorum.tessera.data.EncryptedTransactionDAO)4 StagingEntityDAO (com.quorum.tessera.data.staging.StagingEntityDAO)4 PublicKey (com.quorum.tessera.encryption.PublicKey)4 PushBatchRequest (com.quorum.tessera.recovery.resend.PushBatchRequest)4 ResendBatchRequest (com.quorum.tessera.recovery.resend.ResendBatchRequest)4 BatchResendManager (com.quorum.tessera.recovery.workflow.BatchResendManager)4 BatchWorkflow (com.quorum.tessera.recovery.workflow.BatchWorkflow)4 BatchWorkflowContext (com.quorum.tessera.recovery.workflow.BatchWorkflowContext)4 BatchWorkflowFactory (com.quorum.tessera.recovery.workflow.BatchWorkflowFactory)4 List (java.util.List)4 IntStream (java.util.stream.IntStream)4 Test (org.junit.Test)4 Base64Codec (com.quorum.tessera.base64.Base64Codec)3 EncryptedTransaction (com.quorum.tessera.data.EncryptedTransaction)3 StagingTransaction (com.quorum.tessera.data.staging.StagingTransaction)3 com.quorum.tessera.enclave (com.quorum.tessera.enclave)3 Nonce (com.quorum.tessera.encryption.Nonce)3 Collections.emptyMap (java.util.Collections.emptyMap)3 Collections.singletonList (java.util.Collections.singletonList)3