use of com.github.ambry.protocol.UndeleteRequest in project ambry by linkedin.
the class ServerTestUtil method undeleteBlob.
static void undeleteBlob(ConnectedChannel channel, BlobId blobId, long ts, ServerErrorCode expectedErrorCode, short lifeVersion) throws Exception {
UndeleteRequest undeleteRequest = new UndeleteRequest(1, "undeleteClient", blobId, ts);
DataInputStream stream = channel.sendAndReceive(undeleteRequest).getInputStream();
UndeleteResponse undeleteResponse = UndeleteResponse.readFrom(stream);
releaseNettyBufUnderneathStream(stream);
assertEquals("Unexpected ServerErrorCode for UndeleteRequest", expectedErrorCode, undeleteResponse.getError());
if (undeleteResponse.getError() == ServerErrorCode.No_Error || undeleteResponse.getError() == ServerErrorCode.Blob_Already_Undeleted) {
assertEquals(lifeVersion, undeleteResponse.getLifeVersion());
}
}
use of com.github.ambry.protocol.UndeleteRequest in project ambry by linkedin.
the class ServerHardDeleteTest method undeleteBlob.
/**
* Undeletes a single blob from ambry server node
* @param blobId the {@link BlobId} that needs to be undeleted
* @param channel the {@link ConnectedChannel} to use to send and receive data
* @throws IOException
*/
void undeleteBlob(BlobId blobId, ConnectedChannel channel) throws IOException {
UndeleteRequest unDeleteRequest = new UndeleteRequest(1, "client1", blobId, time.milliseconds());
UndeleteResponse undeleteResponse = UndeleteResponse.readFrom(channel.sendAndReceive(unDeleteRequest).getInputStream());
Assert.assertEquals("BlobId " + blobId + " undelete failed", ServerErrorCode.No_Error, undeleteResponse.getError());
}
Aggregations