...
Protocol Terms
Any binary protocol will require following things
Version: This indicates the API version.
Request Type: This indicates API needs to invoke.
Correlation Id: This helps to relate request-response.
Object Type: What is the type of serialized object.
Response Type: It indicates whether resposne is partial or complete.
Error Handling: It indicates the problem with API invocation.
Streaming support: To support the large response or continuous response.
Command Request Format: Api request and response.
Byte Order(Big Endian)
Request: It indicates client's message
Response: It indicates server's message.
Message: Bytes which contains defined format.
Connect
The new protocol will be integrated with current Geode server. The new client driver can connect with Geode server by sending byte “110”.
...
Geode supports only few object types as the region Key. In the request format The region key will be marked as KeyObject in the request format.
ObjectValueType
All the supported Geode types can be defined as the region value. In the request format the region value will be marked as ValueObject. Value object will be preceded by ValueHeader. This will represent the size of the serialized bytes of ValueObject. It will consume 5-byte in request format. And it will be marked as ValueHeader in the request format.
...
ReponseType will indicate that whether the response is partial or complete. A client can process a partial response. Response with FullResponse type id will indicate the completion of that request.
In the case of the partial response, a client would see the stream of response which it can process as it receives. The response format will contain the 2-bytes(int16) for response type. It will be marked as FullResponse or PartialResponse in request the response format.
ResponseType | ResponseTypeId |
---|---|
FullResponse | 1 |
PartialResponse | 2 |
...
Exception Type | ErrorCode |
---|---|
AUTHENICATION_REQUIRED_EXCEPTION | 1 |
AUTHORIZATION_FAILED_EXCEPTION | 2 |
AUTHETICATIONFAILED_EXCEPTION | 3 |
BUCKET_MOVED_EXCEPTION | 4 |
SERIALIZATION_EXCEPTION | 5 |
INTERRUPTED_EXCEPTION | 6 |
ILLEGAL_ARGUMNET_EXCEPTION | 7 |
ILLEGAL_STATE_EXCEPTION | 8 |
TIMEOUT_EXCEPTION | 9 |
CACHE_WRITER_EXCEPTION | 10 |
REGION_EXIST_EXCEPTION | 11 |
REGION_NOT_EXIST_EXCEPTION | 12 |
LEASE_EXPIRED_EXCEPTION | 13 |
CACHE_LOADER_EXCEPTION | 14 |
REGION_DESTROYED_EXCEPTION | 15 |
ENTRY_DESTROYED_EXCEPTION | 16 |
ENTRY_NOT_FOUND_EXCEPTION | 17 |
FUNCTION_NOT_FOUND_EXCEPTION | 18 |
FUNCTION_ATTRIBUTE_MISMATCH_EXCEPTION | 19 |
FUNCTION_EXECUTION_EXCEPTION | 20 |
CONCURRENT_MODIFICATION_EXCEPTION | 21 |
UNKNOWN_EXCEPTION | 22 |
CLASS_CAST_EXCEPTION | 23 |
GEODE_IO_EXCEPTION | 24 |
NULL_POINTER_EXCEPTION | 25 |
ENTRY_EXIST_EXCEPTION | 26 |
DISK_ACCESS_EXCEPTION | 27 |
QUERY_EXCEPTION | 28 |
CACHE_CLOSED_EXCEPTION | 29 |
MESSAGE_FORMAT_EXCEPTION | 30 |
CACHE_LISTENER_EXCEPTION | 31 |
CQ_EXCEPTION | 32 |
CQ_CLOSED_EXCEPTION | 33 |
CQ_QUERY_EXCEPTION | 34 |
CQ_EXIST_EXCEPTION | 35 |
CQ_INVALID_EXCEPTION | 36 |
INVALID_DELTA_EXCEPTION | 37 |
TRANSACTION_EXCEPTION | 38 |
TRANSACTION_DATA_NODE_DEPARTED_EXCEPTION | 39 |
TRANSACTION_REBALANCED_EXCEPTION | 40 |
COMMIT_CONFLICT_EXCEPTION | 41 |
PUTALL_PARTIAL_RESULT_EXCEPTION | 42 |
...
Message(Framing)
A message is series of bytes which contains request or response. If the message is large, then we need to divide the message into small messages. Then message can be sent in following way.
Message --> MessageHeader [Request | Response] |
---|
MessageHeader --> Size PartialMessage CorrelationId |
Size --> int32 (Size of request or response) |
PartialMessage --> boolean (isMessageCompleted) |
CorrelationId -->int32( to co-relate request and response) |
Request Format
Request --> RequestType Version hasMetaData [MetaData] |
---|
RequestType --> RequestTypeId |
version --> int16 (api version) |
hasMetaData --> boolean (if there is any meta data associated with this request) |
MetaData --> optional |