Search in sources :

Example 56 with ServerErrorCode

use of com.github.ambry.server.ServerErrorCode in project ambry by linkedin.

the class ServerAdminTool method getBlob.

/**
 * Gets blob data for {@code blobId}.
 * @param dataNodeId the {@link DataNodeId} to contact.
 * @param blobId the {@link BlobId} to operate on.
 * @param getOption the {@link GetOption} to send with the {@link GetRequest}.
 * @param clusterMap the {@link ClusterMap} to use.
 * @return the {@link ServerErrorCode} and {@link BlobData} for {@code blobId}
 * @throws Exception
 */
public Pair<ServerErrorCode, BlobData> getBlob(DataNodeId dataNodeId, BlobId blobId, GetOption getOption, ClusterMap clusterMap) throws Exception {
    Pair<ServerErrorCode, InputStream> response = getGetResponse(dataNodeId, blobId, MessageFormatFlags.Blob, getOption, clusterMap);
    InputStream stream = response.getSecond();
    BlobData blobData = stream != null ? MessageFormatRecord.deserializeBlob(stream) : null;
    return new Pair<>(response.getFirst(), blobData);
}
Also used : DataInputStream(java.io.DataInputStream) NettyByteBufDataInputStream(com.github.ambry.utils.NettyByteBufDataInputStream) InputStream(java.io.InputStream) BlobData(com.github.ambry.messageformat.BlobData) ServerErrorCode(com.github.ambry.server.ServerErrorCode) Pair(com.github.ambry.utils.Pair)

Aggregations

ServerErrorCode (com.github.ambry.server.ServerErrorCode)56 ArrayList (java.util.ArrayList)21 Test (org.junit.Test)20 DataInputStream (java.io.DataInputStream)16 BlobProperties (com.github.ambry.messageformat.BlobProperties)12 IOException (java.io.IOException)11 HashMap (java.util.HashMap)11 BlobId (com.github.ambry.commons.BlobId)10 VerifiableProperties (com.github.ambry.config.VerifiableProperties)10 MessageFormatException (com.github.ambry.messageformat.MessageFormatException)9 NettyByteBufDataInputStream (com.github.ambry.utils.NettyByteBufDataInputStream)9 MockClusterMap (com.github.ambry.clustermap.MockClusterMap)8 LoggingNotificationSystem (com.github.ambry.commons.LoggingNotificationSystem)8 RouterConfig (com.github.ambry.config.RouterConfig)8 Map (java.util.Map)8 Properties (java.util.Properties)8 DataNodeId (com.github.ambry.clustermap.DataNodeId)7 PartitionId (com.github.ambry.clustermap.PartitionId)7 MessageInfo (com.github.ambry.store.MessageInfo)7 IdUndeletedStoreException (com.github.ambry.store.IdUndeletedStoreException)6