def decode(msg):
     msg.next_frame()
     initial_frame = msg.next_frame()
     cost = FixSizedTypesCodec.decode_long(initial_frame.buf,
                                           _COST_DECODE_OFFSET)
     creation_time = FixSizedTypesCodec.decode_long(
         initial_frame.buf, _CREATION_TIME_DECODE_OFFSET)
     expiration_time = FixSizedTypesCodec.decode_long(
         initial_frame.buf, _EXPIRATION_TIME_DECODE_OFFSET)
     hits = FixSizedTypesCodec.decode_long(initial_frame.buf,
                                           _HITS_DECODE_OFFSET)
     last_access_time = FixSizedTypesCodec.decode_long(
         initial_frame.buf, _LAST_ACCESS_TIME_DECODE_OFFSET)
     last_stored_time = FixSizedTypesCodec.decode_long(
         initial_frame.buf, _LAST_STORED_TIME_DECODE_OFFSET)
     last_update_time = FixSizedTypesCodec.decode_long(
         initial_frame.buf, _LAST_UPDATE_TIME_DECODE_OFFSET)
     version = FixSizedTypesCodec.decode_long(initial_frame.buf,
                                              _VERSION_DECODE_OFFSET)
     ttl = FixSizedTypesCodec.decode_long(initial_frame.buf,
                                          _TTL_DECODE_OFFSET)
     max_idle = FixSizedTypesCodec.decode_long(initial_frame.buf,
                                               _MAX_IDLE_DECODE_OFFSET)
     key = DataCodec.decode(msg)
     value = DataCodec.decode(msg)
     CodecUtil.fast_forward_to_end_frame(msg)
     return SimpleEntryView(key, value, cost, creation_time,
                            expiration_time, hits, last_access_time,
                            last_stored_time, last_update_time, version,
                            ttl, max_idle)
 def decode(msg):
     msg.next_frame()
     initial_frame = msg.next_frame()
     member_id_high = FixSizedTypesCodec.decode_long(initial_frame.buf, _MEMBER_ID_HIGH_DECODE_OFFSET)
     member_id_low = FixSizedTypesCodec.decode_long(initial_frame.buf, _MEMBER_ID_LOW_DECODE_OFFSET)
     local_id_high = FixSizedTypesCodec.decode_long(initial_frame.buf, _LOCAL_ID_HIGH_DECODE_OFFSET)
     local_id_low = FixSizedTypesCodec.decode_long(initial_frame.buf, _LOCAL_ID_LOW_DECODE_OFFSET)
     CodecUtil.fast_forward_to_end_frame(msg)
     return _SqlQueryId(member_id_high, member_id_low, local_id_high, local_id_low)
예제 #3
0
 def decode(msg):
     msg.next_frame()
     initial_frame = msg.next_frame()
     seed = FixSizedTypesCodec.decode_long(initial_frame.buf,
                                           _SEED_DECODE_OFFSET)
     id = FixSizedTypesCodec.decode_long(initial_frame.buf,
                                         _ID_DECODE_OFFSET)
     name = StringCodec.decode(msg)
     CodecUtil.fast_forward_to_end_frame(msg)
     return RaftGroupId(name, seed, id)
예제 #4
0
def decode_response(msg):
    initial_frame = msg.next_frame()
    response = dict()
    response["base"] = FixSizedTypesCodec.decode_long(initial_frame.buf,
                                                      _RESPONSE_BASE_OFFSET)
    response["increment"] = FixSizedTypesCodec.decode_long(
        initial_frame.buf, _RESPONSE_INCREMENT_OFFSET)
    response["batch_size"] = FixSizedTypesCodec.decode_int(
        initial_frame.buf, _RESPONSE_BATCH_SIZE_OFFSET)
    return response
def decode_response(msg):
    initial_frame = msg.next_frame()
    response = dict()
    response["session_id"] = FixSizedTypesCodec.decode_long(
        initial_frame.buf, _RESPONSE_SESSION_ID_OFFSET)
    response["ttl_millis"] = FixSizedTypesCodec.decode_long(
        initial_frame.buf, _RESPONSE_TTL_MILLIS_OFFSET)
    response["heartbeat_millis"] = FixSizedTypesCodec.decode_long(
        initial_frame.buf, _RESPONSE_HEARTBEAT_MILLIS_OFFSET)
    return response
예제 #6
0
def decode_response(msg):
    initial_frame = msg.next_frame()
    response = dict()
    response["fence"] = FixSizedTypesCodec.decode_long(initial_frame.buf,
                                                       _RESPONSE_FENCE_OFFSET)
    response["lock_count"] = FixSizedTypesCodec.decode_int(
        initial_frame.buf, _RESPONSE_LOCK_COUNT_OFFSET)
    response["session_id"] = FixSizedTypesCodec.decode_long(
        initial_frame.buf, _RESPONSE_SESSION_ID_OFFSET)
    response["thread_id"] = FixSizedTypesCodec.decode_long(
        initial_frame.buf, _RESPONSE_THREAD_ID_OFFSET)
    return response
def decode_response(msg):
    initial_frame = msg.next_frame()
    response = dict()
    response["value"] = FixSizedTypesCodec.decode_long(initial_frame.buf, _RESPONSE_VALUE_OFFSET)
    response["replica_count"] = FixSizedTypesCodec.decode_int(initial_frame.buf, _RESPONSE_REPLICA_COUNT_OFFSET)
    response["replica_timestamps"] = EntryListUUIDLongCodec.decode(msg)
    return response
예제 #8
0
def handle(msg,
           handle_i_map_invalidation_event=None,
           handle_i_map_batch_invalidation_event=None):
    message_type = msg.get_message_type()
    if message_type == _EVENT_I_MAP_INVALIDATION_MESSAGE_TYPE and handle_i_map_invalidation_event is not None:
        initial_frame = msg.next_frame()
        source_uuid = FixSizedTypesCodec.decode_uuid(
            initial_frame.buf, _EVENT_I_MAP_INVALIDATION_SOURCE_UUID_OFFSET)
        partition_uuid = FixSizedTypesCodec.decode_uuid(
            initial_frame.buf, _EVENT_I_MAP_INVALIDATION_PARTITION_UUID_OFFSET)
        sequence = FixSizedTypesCodec.decode_long(
            initial_frame.buf, _EVENT_I_MAP_INVALIDATION_SEQUENCE_OFFSET)
        key = CodecUtil.decode_nullable(msg, DataCodec.decode)
        handle_i_map_invalidation_event(key, source_uuid, partition_uuid,
                                        sequence)
        return
    if message_type == _EVENT_I_MAP_BATCH_INVALIDATION_MESSAGE_TYPE and handle_i_map_batch_invalidation_event is not None:
        msg.next_frame()
        keys = ListMultiFrameCodec.decode(msg, DataCodec.decode)
        source_uuids = ListUUIDCodec.decode(msg)
        partition_uuids = ListUUIDCodec.decode(msg)
        sequences = ListLongCodec.decode(msg)
        handle_i_map_batch_invalidation_event(keys, source_uuids,
                                              partition_uuids, sequences)
        return
예제 #9
0
def decode_response(msg):
    initial_frame = msg.next_frame()
    response = dict()
    response["max_idle"] = FixSizedTypesCodec.decode_long(
        initial_frame.buf, _RESPONSE_MAX_IDLE_OFFSET)
    response["response"] = CodecUtil.decode_nullable(
        msg, SimpleEntryViewCodec.decode)
    return response
def handle(msg, handle_backup_event=None):
    message_type = msg.get_message_type()
    if message_type == _EVENT_BACKUP_MESSAGE_TYPE and handle_backup_event is not None:
        initial_frame = msg.next_frame()
        source_invocation_correlation_id = FixSizedTypesCodec.decode_long(
            initial_frame.buf,
            _EVENT_BACKUP_SOURCE_INVOCATION_CORRELATION_ID_OFFSET)
        handle_backup_event(source_invocation_correlation_id)
        return
def decode_response(msg):
    initial_frame = msg.next_frame()
    response = dict()
    response["update_count"] = FixSizedTypesCodec.decode_long(
        initial_frame.buf, _RESPONSE_UPDATE_COUNT_OFFSET)
    response["row_metadata"] = ListMultiFrameCodec.decode_nullable(
        msg, SqlColumnMetadataCodec.decode)
    response["row_page"] = CodecUtil.decode_nullable(msg, SqlPageCodec.decode)
    response["error"] = CodecUtil.decode_nullable(msg, SqlErrorCodec.decode)
    return response
예제 #12
0
def handle(msg, handle_topic_event=None):
    message_type = msg.get_message_type()
    if message_type == _EVENT_TOPIC_MESSAGE_TYPE and handle_topic_event is not None:
        initial_frame = msg.next_frame()
        publish_time = FixSizedTypesCodec.decode_long(
            initial_frame.buf, _EVENT_TOPIC_PUBLISH_TIME_OFFSET)
        uuid = FixSizedTypesCodec.decode_uuid(initial_frame.buf,
                                              _EVENT_TOPIC_UUID_OFFSET)
        item = DataCodec.decode(msg)
        handle_topic_event(item, publish_time, uuid)
        return
def decode_response(msg):
    initial_frame = msg.next_frame()
    response = dict()
    response["read_count"] = FixSizedTypesCodec.decode_int(
        initial_frame.buf, _RESPONSE_READ_COUNT_OFFSET)
    response["next_seq"] = FixSizedTypesCodec.decode_long(
        initial_frame.buf, _RESPONSE_NEXT_SEQ_OFFSET)
    response["items"] = ListMultiFrameCodec.decode(msg, DataCodec.decode)
    response["item_seqs"] = CodecUtil.decode_nullable(msg,
                                                      LongArrayCodec.decode)
    return response
def decode_response(msg):
    initial_frame = msg.next_frame()
    return FixSizedTypesCodec.decode_long(initial_frame.buf,
                                          _RESPONSE_RESPONSE_OFFSET)
 def test_long(self):
     FixSizedTypesCodec.encode_long(self.buf, 16, 1234567890123)
     message = self.write_and_decode()
     buf = message.next_frame().buf
     self.assertEqual(1234567890123, FixSizedTypesCodec.decode_long(buf, 10))
예제 #16
0
def decode_response(msg):
    initial_frame = msg.next_frame()
    response = dict()
    response["oldest_sequence"] = FixSizedTypesCodec.decode_long(initial_frame.buf, _RESPONSE_OLDEST_SEQUENCE_OFFSET)
    response["newest_sequence"] = FixSizedTypesCodec.decode_long(initial_frame.buf, _RESPONSE_NEWEST_SEQUENCE_OFFSET)
    return response