Search in sources :

Example 11 with UndeleteRequest

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());
    }
}
Also used : UndeleteRequest(com.github.ambry.protocol.UndeleteRequest) UndeleteResponse(com.github.ambry.protocol.UndeleteResponse) NettyByteBufDataInputStream(com.github.ambry.utils.NettyByteBufDataInputStream) DataInputStream(java.io.DataInputStream)

Example 12 with UndeleteRequest

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());
}
Also used : UndeleteRequest(com.github.ambry.protocol.UndeleteRequest) UndeleteResponse(com.github.ambry.protocol.UndeleteResponse)

Aggregations

UndeleteRequest (com.github.ambry.protocol.UndeleteRequest)12 UndeleteResponse (com.github.ambry.protocol.UndeleteResponse)7 BlobId (com.github.ambry.commons.BlobId)6 DeleteRequest (com.github.ambry.protocol.DeleteRequest)6 GetResponse (com.github.ambry.protocol.GetResponse)6 PartitionRequestInfo (com.github.ambry.protocol.PartitionRequestInfo)6 BlobProperties (com.github.ambry.messageformat.BlobProperties)5 DeleteResponse (com.github.ambry.protocol.DeleteResponse)5 GetRequest (com.github.ambry.protocol.GetRequest)5 PutRequest (com.github.ambry.protocol.PutRequest)5 PutResponse (com.github.ambry.protocol.PutResponse)5 DataInputStream (java.io.DataInputStream)5 ArrayList (java.util.ArrayList)5 MockPartitionId (com.github.ambry.clustermap.MockPartitionId)4 PartitionId (com.github.ambry.clustermap.PartitionId)4 ReplicaId (com.github.ambry.clustermap.ReplicaId)4 MessageFormatException (com.github.ambry.messageformat.MessageFormatException)4 NettyByteBufDataInputStream (com.github.ambry.utils.NettyByteBufDataInputStream)4 IOException (java.io.IOException)4 AccountService (com.github.ambry.account.AccountService)3