def decode(msg): msg.next_frame() initial_frame = msg.next_frame() major = FixSizedTypesCodec.decode_byte(initial_frame.buf, _MAJOR_DECODE_OFFSET) minor = FixSizedTypesCodec.decode_byte(initial_frame.buf, _MINOR_DECODE_OFFSET) patch = FixSizedTypesCodec.decode_byte(initial_frame.buf, _PATCH_DECODE_OFFSET) CodecUtil.fast_forward_to_end_frame(msg) return MemberVersion(major, minor, patch)
def decode_response(msg): initial_frame = msg.next_frame() response = dict() response["status"] = FixSizedTypesCodec.decode_byte( initial_frame.buf, _RESPONSE_STATUS_OFFSET) response["member_uuid"] = FixSizedTypesCodec.decode_uuid( initial_frame.buf, _RESPONSE_MEMBER_UUID_OFFSET) response["serialization_version"] = FixSizedTypesCodec.decode_byte( initial_frame.buf, _RESPONSE_SERIALIZATION_VERSION_OFFSET) response["partition_count"] = FixSizedTypesCodec.decode_int( initial_frame.buf, _RESPONSE_PARTITION_COUNT_OFFSET) response["cluster_id"] = FixSizedTypesCodec.decode_uuid( initial_frame.buf, _RESPONSE_CLUSTER_ID_OFFSET) response["failover_supported"] = FixSizedTypesCodec.decode_boolean( initial_frame.buf, _RESPONSE_FAILOVER_SUPPORTED_OFFSET) response["address"] = CodecUtil.decode_nullable(msg, AddressCodec.decode) response["server_hazelcast_version"] = StringCodec.decode(msg) return response
def decode(msg): msg.next_frame() initial_frame = msg.next_frame() page_size = FixSizedTypesCodec.decode_int(initial_frame.buf, _PAGE_SIZE_DECODE_OFFSET) page = FixSizedTypesCodec.decode_int(initial_frame.buf, _PAGE_DECODE_OFFSET) iteration_type_id = FixSizedTypesCodec.decode_byte(initial_frame.buf, _ITERATION_TYPE_ID_DECODE_OFFSET) anchor_data_list_holder = AnchorDataListHolderCodec.decode(msg) predicate_data = CodecUtil.decode_nullable(msg, DataCodec.decode) comparator_data = CodecUtil.decode_nullable(msg, DataCodec.decode) partition_key_data = CodecUtil.decode_nullable(msg, DataCodec.decode) CodecUtil.fast_forward_to_end_frame(msg) return PagingPredicateHolder(anchor_data_list_holder, predicate_data, comparator_data, page_size, page, iteration_type_id, partition_key_data)
def test_byte(self): FixSizedTypesCodec.encode_byte(self.buf, 16, 3) message = self.write_and_decode() buf = message.next_frame().buf self.assertEqual(3, FixSizedTypesCodec.decode_byte(buf, 10))