Esempio n. 1
0
def handle(msg, handle_partition_lost_event=None):
    message_type = msg.get_message_type()
    if message_type == _EVENT_PARTITION_LOST_MESSAGE_TYPE and handle_partition_lost_event is not None:
        initial_frame = msg.next_frame()
        partition_id = FixSizedTypesCodec.decode_int(
            initial_frame.buf, _EVENT_PARTITION_LOST_PARTITION_ID_OFFSET)
        lost_backup_count = FixSizedTypesCodec.decode_int(
            initial_frame.buf, _EVENT_PARTITION_LOST_LOST_BACKUP_COUNT_OFFSET)
        source = FixSizedTypesCodec.decode_uuid(
            initial_frame.buf, _EVENT_PARTITION_LOST_SOURCE_OFFSET)
        handle_partition_lost_event(partition_id, lost_backup_count, source)
        return
Esempio n. 2
0
 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 handle(msg, handle_entry_event=None):
    message_type = msg.get_message_type()
    if message_type == _EVENT_ENTRY_MESSAGE_TYPE and handle_entry_event is not None:
        initial_frame = msg.next_frame()
        event_type = FixSizedTypesCodec.decode_int(initial_frame.buf, _EVENT_ENTRY_EVENT_TYPE_OFFSET)
        uuid = FixSizedTypesCodec.decode_uuid(initial_frame.buf, _EVENT_ENTRY_UUID_OFFSET)
        number_of_affected_entries = FixSizedTypesCodec.decode_int(initial_frame.buf, _EVENT_ENTRY_NUMBER_OF_AFFECTED_ENTRIES_OFFSET)
        key = CodecUtil.decode_nullable(msg, DataCodec.decode)
        value = CodecUtil.decode_nullable(msg, DataCodec.decode)
        old_value = CodecUtil.decode_nullable(msg, DataCodec.decode)
        merging_value = CodecUtil.decode_nullable(msg, DataCodec.decode)
        handle_entry_event(key, value, old_value, merging_value, event_type, uuid, number_of_affected_entries)
        return
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
 def decode(msg):
     msg.next_frame()
     initial_frame = msg.next_frame()
     unique_key_transformation = FixSizedTypesCodec.decode_int(initial_frame.buf, _UNIQUE_KEY_TRANSFORMATION_DECODE_OFFSET)
     unique_key = StringCodec.decode(msg)
     CodecUtil.fast_forward_to_end_frame(msg)
     return BitmapIndexOptions(unique_key, unique_key_transformation)
Esempio n. 6
0
 def decode(msg):
     msg.next_frame()
     initial_frame = msg.next_frame()
     port = FixSizedTypesCodec.decode_int(initial_frame.buf, _PORT_DECODE_OFFSET)
     host = StringCodec.decode(msg)
     CodecUtil.fast_forward_to_end_frame(msg)
     return Address(host, port)
 def decode(msg):
     msg.next_frame()
     initial_frame = msg.next_frame()
     kind = FixSizedTypesCodec.decode_int(initial_frame.buf,
                                          _KIND_DECODE_OFFSET)
     name = StringCodec.decode(msg)
     CodecUtil.fast_forward_to_end_frame(msg)
     return FieldDescriptor(name, kind)
Esempio n. 8
0
 def decode(msg):
     msg.next_frame()
     initial_frame = msg.next_frame()
     type = FixSizedTypesCodec.decode_int(initial_frame.buf,
                                          _TYPE_DECODE_OFFSET)
     identifier = CodecUtil.decode_nullable(msg, StringCodec.decode)
     CodecUtil.fast_forward_to_end_frame(msg)
     return EndpointQualifier(type, identifier)
def handle(msg, handle_item_event=None):
    message_type = msg.get_message_type()
    if message_type == _EVENT_ITEM_MESSAGE_TYPE and handle_item_event is not None:
        initial_frame = msg.next_frame()
        uuid = FixSizedTypesCodec.decode_uuid(initial_frame.buf, _EVENT_ITEM_UUID_OFFSET)
        event_type = FixSizedTypesCodec.decode_int(initial_frame.buf, _EVENT_ITEM_EVENT_TYPE_OFFSET)
        item = CodecUtil.decode_nullable(msg, DataCodec.decode)
        handle_item_event(item, uuid, event_type)
        return
Esempio n. 10
0
def handle(msg,
           handle_members_view_event=None,
           handle_partitions_view_event=None):
    message_type = msg.get_message_type()
    if message_type == _EVENT_MEMBERS_VIEW_MESSAGE_TYPE and handle_members_view_event is not None:
        initial_frame = msg.next_frame()
        version = FixSizedTypesCodec.decode_int(
            initial_frame.buf, _EVENT_MEMBERS_VIEW_VERSION_OFFSET)
        member_infos = ListMultiFrameCodec.decode(msg, MemberInfoCodec.decode)
        handle_members_view_event(version, member_infos)
        return
    if message_type == _EVENT_PARTITIONS_VIEW_MESSAGE_TYPE and handle_partitions_view_event is not None:
        initial_frame = msg.next_frame()
        version = FixSizedTypesCodec.decode_int(
            initial_frame.buf, _EVENT_PARTITIONS_VIEW_VERSION_OFFSET)
        partitions = EntryListUUIDListIntegerCodec.decode(msg)
        handle_partitions_view_event(version, partitions)
        return
Esempio n. 11
0
 def decode(msg):
     msg.next_frame()
     initial_frame = msg.next_frame()
     error_code = FixSizedTypesCodec.decode_int(initial_frame.buf, _ERROR_CODE_DECODE_OFFSET)
     class_name = StringCodec.decode(msg)
     message = CodecUtil.decode_nullable(msg, StringCodec.decode)
     stack_trace_elements = ListMultiFrameCodec.decode(msg, StackTraceElementCodec.decode)
     CodecUtil.fast_forward_to_end_frame(msg)
     return ErrorHolder(error_code, class_name, message, stack_trace_elements)
Esempio n. 12
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
Esempio n. 13
0
def handle(msg, handle_map_partition_lost_event=None):
    message_type = msg.get_message_type()
    if message_type == _EVENT_MAP_PARTITION_LOST_MESSAGE_TYPE and handle_map_partition_lost_event is not None:
        initial_frame = msg.next_frame()
        partition_id = FixSizedTypesCodec.decode_int(
            initial_frame.buf, _EVENT_MAP_PARTITION_LOST_PARTITION_ID_OFFSET)
        uuid = FixSizedTypesCodec.decode_uuid(
            initial_frame.buf, _EVENT_MAP_PARTITION_LOST_UUID_OFFSET)
        handle_map_partition_lost_event(partition_id, uuid)
        return
Esempio n. 14
0
 def decode(msg):
     msg.next_frame()
     initial_frame = msg.next_frame()
     line_number = FixSizedTypesCodec.decode_int(
         initial_frame.buf, _LINE_NUMBER_DECODE_OFFSET)
     class_name = StringCodec.decode(msg)
     method_name = StringCodec.decode(msg)
     file_name = CodecUtil.decode_nullable(msg, StringCodec.decode)
     CodecUtil.fast_forward_to_end_frame(msg)
     return StackTraceElement(class_name, method_name, file_name,
                              line_number)
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(msg):
     msg.next_frame()
     initial_frame = msg.next_frame()
     type = FixSizedTypesCodec.decode_int(initial_frame.buf,
                                          _TYPE_DECODE_OFFSET)
     name = CodecUtil.decode_nullable(msg, StringCodec.decode)
     attributes = ListMultiFrameCodec.decode(msg, StringCodec.decode)
     bitmap_index_options = CodecUtil.decode_nullable(
         msg, BitmapIndexOptionsCodec.decode)
     CodecUtil.fast_forward_to_end_frame(msg)
     return IndexConfig(name, type, attributes, bitmap_index_options)
Esempio n. 17
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
Esempio n. 18
0
 def decode(msg):
     msg.next_frame()
     initial_frame = msg.next_frame()
     code = FixSizedTypesCodec.decode_int(initial_frame.buf, _CODE_DECODE_OFFSET)
     originating_member_id = FixSizedTypesCodec.decode_uuid(initial_frame.buf, _ORIGINATING_MEMBER_ID_DECODE_OFFSET)
     message = CodecUtil.decode_nullable(msg, StringCodec.decode)
     is_suggestion_exists = False
     suggestion = None
     if not msg.peek_next_frame().is_end_frame():
         suggestion = CodecUtil.decode_nullable(msg, StringCodec.decode)
         is_suggestion_exists = True
     CodecUtil.fast_forward_to_end_frame(msg)
     return _SqlError(code, message, originating_member_id, is_suggestion_exists, suggestion)
Esempio n. 19
0
 def decode(msg):
     msg.next_frame()
     initial_frame = msg.next_frame()
     type = FixSizedTypesCodec.decode_int(initial_frame.buf,
                                          _TYPE_DECODE_OFFSET)
     is_nullable_exists = False
     nullable = False
     if len(initial_frame.buf
            ) >= _NULLABLE_DECODE_OFFSET + BOOLEAN_SIZE_IN_BYTES:
         nullable = FixSizedTypesCodec.decode_boolean(
             initial_frame.buf, _NULLABLE_DECODE_OFFSET)
         is_nullable_exists = True
     name = StringCodec.decode(msg)
     CodecUtil.fast_forward_to_end_frame(msg)
     return SqlColumnMetadata(name, type, is_nullable_exists, nullable)
Esempio n. 20
0
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
Esempio n. 21
0
def decode_response(msg):
    initial_frame = msg.next_frame()
    return FixSizedTypesCodec.decode_int(initial_frame.buf, _RESPONSE_RESPONSE_OFFSET)
 def test_int(self):
     FixSizedTypesCodec.encode_int(self.buf, 16, 1234)
     message = self.write_and_decode()
     buf = message.next_frame().buf
     self.assertEqual(1234, FixSizedTypesCodec.decode_int(buf, 10))