OP_GET_BINARY_TYPE
ID | IEP-9 | ||||||||
Author | Pavel Tupitsyn | ||||||||
Sponsor | Pavel Tupitsyn | ||||||||
Created | 20-NOV-2017 | ||||||||
Status |
|
...
|
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 |
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 ... |
...
Usage details with examples have been documented on:
...
See "thin client" component in JIRA
...