Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

We will support all the object types which Geode understands. This would include all the primitive java primitive types, an array of primitive types, collections, java serialization, data serializable, pdx serialization and custom user data serializers. For the purpose of the request format, we would distinguish key type and value type.

...

All the supported Geode types can be defined as the region value. In the request format, the region value will be marked as ValueObject. The ValueObject will contain the serialized bytes. We will have the ability to send those bytes in the chunk.

ResponseType

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. 

...

Exception TypeErrorCode
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

Format Grammer

Format is described using Extended Backus–Naur form grammer.

ProtocolTypes

The format contains following fixed and variable types. They need to serialize in Big Indian byte order as showed for the example.

TypeNumber Of BytesValueSerializedBytes
booleanFixed = 1true0x01 
booleanFixed = 1false0x00
int8Fixed = 110x01
int16Fixed = 210x00 0x01 
int32Fixed = 410x00 0x00 0x00 0x01 
String(utf)

Variable

  • 2 byte for length of encoded String
  • Utf Encoding
"Geode"

0x00 0x05 (length)

0x47 0x65 0x6f 0x64 0x65 (utf encoding)


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.

...

Request Format

Request --> RequestType Version apiVersion hasMetaData [MetaData] RequestAPI
RequestType --> RequestTypeId
version --> int16 (api version)
hasMetaData --> boolean (if there is any meta data associated with this request)
MetaData --> optional

RequestAPI --> (PutRequest | GetRequest | PutAllRequest | GetAllRequest)

...

ValueObject --> Serializedbytes
Serializedbytes --> SerializedBytesHeader PartialSerializedBytes [{SerializedBytesHeader PartialSerializedBytes]}
SerializedBytesHeader --> Size isPartialBytes
Size --> int int32 (Number of serialized bytes)
isPartialBytes --> boolean

...

Format contains following fixed and variable types. They need to serialize in Big Indian byte order as showed in example.

TypeNumber Of BytesValueSerializedBytes
booleanFixed = 1true0x01 
booleanFixed = 1false0x00
int8Fixed = 110x01
int16Fixed = 210x00 0x01 
int32Fixed = 410x00 0x00 0x00 0x01 
String(utf)

Variable

  • 2 byte for length of encoded String
  • Utf Encoding
"Geode"

0x00 0x05 (length)

0x47 0x65 0x6f 0x64 0x65 (utf encoding)

 

APIS

PutRequestResponse

PutRequest --> RegionName KeyObject CallbackArg ValueObject
RegionName --> String
KeyObject --> Serialized bytes of Geode key object type
CallbackArg –-> Serialized bytes of Geode object type

...

PutAllResponse –-> Success
Success --> Boolean

MetaData

The purpose of metadata to pass defined key value pair with request and response. 

Examples

PutRequest

string regionName = "ExampleRegion"

Key = 101

Value = "New Geode Client Server Protocol"

CallbackArg = Null

MessageHeader

(Size PartialMessage CorrelationId Request)

Request (RequestType apiVersion hasMetaData [MetaData] RequestAPI )

RequestAPI

(RegionName KeyObject CallbackArg ValueObject)

ValueObject (Serializedbytes( SerializedBytesHeader PartialSerializedBytes))

SerializedBytesHeader( Size isPartialBytes) PartialSerializedBytes


Size = Size of Request (66)

0x00 0x00 0x00 0x42

RequestType (PutRequestType = 3)

0x00 0x03

RegionName(type:String, value:"ExampleRegion" )

 len = 0x00 0x0d

Utf Encoding = 0x45 0x78 0x61 0x6d 0x70 0x6c 0x65 0x52 0x65 0x67 0x69 0x6f 0x6e 

Size = (number of serialized bytes = 35)

 0x00 0x00 0x00 0x23

PartialMessage = (type = Boolean, value = false)

0x00

apiVersion (1)

0x00 0x01

KeyObject (Serialzied using geode types, value = 101)

 Geode Int type = 0x39

Value = 0x00 0x00 0x00 0x65 

isPartialBytes = (It contains all serialized bytes, type = boolean)

0x00

CorrelationId = 1

0x00 0x00 0x00 0x01 

hasMetaData (false)

0x00

CallbackArg (Serialzied using geode types, value = null)

Value = 0x29 

PartialSerializedBytes (Serialized as Geode String type, value = "New Geode Client Server Protocol")

Geode String type = 0x57

Serialized Encoded length = 0x00 0x20

Encoded String = 0x4e 0x65 0x77 0x20 0x47 0x65 0x6f 0x64 0x65 0x20 0x43 0x6c 0x69 0x65 0x6e 0x74

0x20 0x53 0x65 0x72 0x76 0x65 0x72 0x20 0x50 0x72 0x6f 0x74 0x6f 0x63 0x6f 0x6c

 

PutResponse