Versions Compared

Key

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

...

"Extension X" is a MsgPack extension type (up to 128 extension types are allowed).

Integer data types, varint encoding

MsgPack provides multiple data types for integer values. When encoding a value, smallest data type for that value is picked automatically.

"int" is used below to denote int format family. Values such as payload size, request ID, error codes, are encoded this way - using variable number of bytes based on the value.

Message format

All messages, request and response, except handshake, start with unsigned integer message length (excluding the length itself).

  • Any MsgPack unsigned integer type can be used, so that shorter messages use smaller type to encode length. Empty message will be single 0 byte.
  • Maximum message length is 2147483647 (Integer.MAX_VALUE and maximum byte array length in Java)
positive fixint / uint8 / uint16 / uint32 / uint64 int Length of Payload
...Payload

...

Request
4 bytesMagic number 49 47 4E 49, or "IGNI". Helps identifying misconfigured SSL or other apps probing the port.
fixint / uintintPayload length
positive fixintintVersion major
positive fixintintVersion minor
positive fixintintVersion patch
positive fixintintClient code (1 for JDBC, 2 for general-purpose client)
binFeatures (bitmask)
map (int → any)Extensions (auth, attributes, etc). Server can skip unknown extension data (when client is newer).

...

Response
4 bytesMagic number 49 47 4E 49, or "IGNI". Helps identifying misconfigured SSL or different server on the port.
fixint / uintintPayload length
positive fixintintServer version major
positive fixintintServer version minor
positive fixintintServer version patch
booleanSuccess flag
stringWhen success flag is false: Error message
binWhen success flag is true: Server features (bitmask)
map (int → any)When success flag is true: Extensions (auth, attributes, etc). Client can skip unknown extension data (when server is newer).

Client Operations

 Upon successful handshake client can start performing operations by sending a request with specific op code. Each operation has it's own request and response format, with a common header.

Request
short
intOperation code
long
intRequest id, generated by client and returned as-is in response
...Operation-specific data

TODO: server → client notifications, how do we handle them easier?


Response
intType = 0
intRequest id
intError
ResponselongRequest id (see above)intStatus
code (0 for success
, otherwise error code
)
stringError message (
present only
when
status
error code is not 0)
...Operation-specific data


Clients should expect notification messages at any moment after the successful handshake.

Notification
intType = 1
intNotification code
...Notification-specific data


Operation codes and request ids are omitted everywhere below for brevity.

Risks and Assumptions

TODO

...