Versions Compared

Key

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

OP_GET_BINARY_TYPE

 

IDIEP-9
AuthorPavel Tupitsyn
SponsorPavel Tupitsyn
Created20-NOV-2017
Status
Status
colourGreyGreen
titleDRAFT

...

COMPLETED


Table of Contents

Info

This page includes low-level protocol documentation that might be outdated and is not maintained. Refer to the official protocol documentation here: https://apacheignite.readme.io/docs/binary-client-protocol

Motivation

Implement thin Ignite client in any programming language / platform using a well-defined binary connectiona protocol.

...

Code Block
// Header
assert socket.readByte() == 103;
assert socket.readByte() == 1;
assert socket.readByte() == 1 + 2;
var typeId = socket.ReadInt();
var hash = socket.readInt();
var len = socket.ReadInt();
var schemaId = socket.ReadInt();
var schemaOffset = socket.ReadInt();
 
// Read field data into array, everything between header and schema
var fieldData = socket.readByteArray(schemaOffset - 24);
 
// Read schema
var fieldCount = (len - schemaOffset) / 8;
var fieldIds = new int[fieldCount];
var fieldOffsets = new int[fieldCount];
 
for (int i = 0; i < fieldCount; i++)
{
  fieldIds[i] = socket.readInt();
  fieldOffsets[i] = socket.readInt();
}
 
// Let's suppose that user wants a value of the field named "myfield"
var fieldName = "myfield";
var fieldId = getJavaHash(fieldName);  // 1515208398
var fieldIdx = fieldIds.indexOf(fieldId);  // Can be missing, handle accordingly
var fieldOffset = fieldOffsets[fieldsIdx];
 
// We got the field offset, now read binary object from fieldData
var reader = new ArrayReader(fieldData);
reader.seek(fieldOffset - 24);
 
var fieldType = reader.readByte();
if (fieldType = 3)  // int
{
  var fieldVal = reader.readInt();
}
else if (fieldVal = 103)
{
  // Nested binary object
  ...
}
else ... 

...

Discussion Links

Usage details with examples have been documented on:

Discussion Links

http://apache-ignite-developers.2346864.n4.http://apache-ignite-developers.2346864.n4.nabble.com/Thin-client-protocol-message-format-td20300.html

...

Tickets

See "thin client" component in JIRA

...