Search in sources :

Example 6 with UndeleteResponse

use of com.github.ambry.protocol.UndeleteResponse 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 7 with UndeleteResponse

use of com.github.ambry.protocol.UndeleteResponse 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

UndeleteResponse (com.github.ambry.protocol.UndeleteResponse)7 UndeleteRequest (com.github.ambry.protocol.UndeleteRequest)6 BlobId (com.github.ambry.commons.BlobId)4 DeleteRequest (com.github.ambry.protocol.DeleteRequest)4 DeleteResponse (com.github.ambry.protocol.DeleteResponse)4 GetResponse (com.github.ambry.protocol.GetResponse)4 PartitionRequestInfo (com.github.ambry.protocol.PartitionRequestInfo)4 PutResponse (com.github.ambry.protocol.PutResponse)4 NettyByteBufDataInputStream (com.github.ambry.utils.NettyByteBufDataInputStream)4 DataInputStream (java.io.DataInputStream)4 AccountService (com.github.ambry.account.AccountService)3 InMemAccountService (com.github.ambry.account.InMemAccountService)3 MockClusterMap (com.github.ambry.clustermap.MockClusterMap)3 MockPartitionId (com.github.ambry.clustermap.MockPartitionId)3 PartitionId (com.github.ambry.clustermap.PartitionId)3 VerifiableProperties (com.github.ambry.config.VerifiableProperties)3 BlobProperties (com.github.ambry.messageformat.BlobProperties)3 MessageFormatException (com.github.ambry.messageformat.MessageFormatException)3 ConnectedChannel (com.github.ambry.network.ConnectedChannel)3 GetRequest (com.github.ambry.protocol.GetRequest)3