Search in sources :

Example 1 with BlobStartPrefixSyncRequest

use of org.elasticsearch.indices.recovery.BlobStartPrefixSyncRequest in project crate by crate.

the class BlobRecoveryHandler method getExistingDigestsFromTarget.

private Set<BytesArray> getExistingDigestsFromTarget(byte prefix) {
    var listener = new PlainActionFuture<BlobStartPrefixResponse>();
    transportService.sendRequest(request.targetNode(), BlobRecoveryTarget.Actions.START_PREFIX, new BlobStartPrefixSyncRequest(request.recoveryId(), request.shardId(), prefix), TransportRequestOptions.EMPTY, new ActionListenerResponseHandler<>(listener, BlobStartPrefixResponse::new));
    BlobStartPrefixResponse response = listener.actionGet();
    Set<BytesArray> result = new HashSet<>();
    for (byte[] digests : response.existingDigests) {
        result.add(new BytesArray(digests));
    }
    return result;
}
Also used : BytesArray(org.elasticsearch.common.bytes.BytesArray) PlainActionFuture(org.elasticsearch.action.support.PlainActionFuture) BlobStartPrefixSyncRequest(org.elasticsearch.indices.recovery.BlobStartPrefixSyncRequest) BlobStartPrefixResponse(org.elasticsearch.indices.recovery.BlobStartPrefixResponse) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 PlainActionFuture (org.elasticsearch.action.support.PlainActionFuture)1 BytesArray (org.elasticsearch.common.bytes.BytesArray)1 BlobStartPrefixResponse (org.elasticsearch.indices.recovery.BlobStartPrefixResponse)1 BlobStartPrefixSyncRequest (org.elasticsearch.indices.recovery.BlobStartPrefixSyncRequest)1