Skip to content

Commit

Permalink
BlockReadDataServerHandler Implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
peisun1115 committed Dec 20, 2016
1 parent 6cd4edf commit 55928ee
Show file tree
Hide file tree
Showing 5 changed files with 191 additions and 382 deletions.
Expand Up @@ -69,6 +69,16 @@ public static RPCBlockReadResponse createErrorResponse(long blockId, Status stat
return new RPCBlockReadResponse(blockId, -1, 0, null, status); return new RPCBlockReadResponse(blockId, -1, 0, null, status);
} }


/**
* Creates a {@link RPCBlockReadResponse} object that indicates a success for the given
* {@link RPCBlockReadRequest}.
*
* @return The generated {@link RPCBlockReadResponse} object
*/
public static RPCBlockReadResponse createSuccessResponse(long blockId) {
return new RPCBlockReadResponse(blockId, -1, 0, null, Status.SUCCESS);
}

/** /**
* Decodes the input {@link ByteBuf} into a {@link RPCBlockReadResponse} object and returns it. * Decodes the input {@link ByteBuf} into a {@link RPCBlockReadResponse} object and returns it.
* *
Expand Down
Expand Up @@ -47,6 +47,7 @@ public enum Status {


// TODO(now): Redesign the error codes. For now, treat all the errors the same. // TODO(now): Redesign the error codes. For now, treat all the errors the same.
FAILED(106), FAILED(106),
CANCELLED(107),
; ;


private static final String DEFAULT_ERROR_STRING = "Unknown error."; private static final String DEFAULT_ERROR_STRING = "Unknown error.";
Expand Down

0 comments on commit 55928ee

Please sign in to comment.