def encode_request(name, uuid, callable):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    FixSizedTypesCodec.encode_uuid(buf, _REQUEST_UUID_OFFSET, uuid)
    StringCodec.encode(buf, name)
    DataCodec.encode(buf, callable, True)
    return OutboundMessage(buf, False)
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
Пример #3
0
def encode_request(name, registration_id):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    FixSizedTypesCodec.encode_uuid(buf, _REQUEST_REGISTRATION_ID_OFFSET,
                                   registration_id)
    StringCodec.encode(buf, name, True)
    return OutboundMessage(buf, True)
Пример #4
0
def encode_request(group_id, name, new_value):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    FixSizedTypesCodec.encode_long(buf, _REQUEST_NEW_VALUE_OFFSET, new_value)
    RaftGroupIdCodec.encode(buf, group_id)
    StringCodec.encode(buf, name, True)
    return OutboundMessage(buf, False)
def encode_request(name, index, value_list):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    FixSizedTypesCodec.encode_int(buf, _REQUEST_INDEX_OFFSET, index)
    StringCodec.encode(buf, name)
    ListMultiFrameCodec.encode(buf, value_list, DataCodec.encode, True)
    return OutboundMessage(buf, False)
def encode_request(uuid, interrupt):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE, True)
    FixSizedTypesCodec.encode_uuid(buf, _REQUEST_UUID_OFFSET, uuid)
    FixSizedTypesCodec.encode_boolean(buf, _REQUEST_INTERRUPT_OFFSET,
                                      interrupt)
    return OutboundMessage(buf, False)
def encode_request(query_id, cursor_buffer_size):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    FixSizedTypesCodec.encode_int(buf, _REQUEST_CURSOR_BUFFER_SIZE_OFFSET,
                                  cursor_buffer_size)
    SqlQueryIdCodec.encode(buf, query_id, True)
    return OutboundMessage(buf, False)
def encode_request(name, key, thread_id):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    FixSizedTypesCodec.encode_long(buf, _REQUEST_THREAD_ID_OFFSET, thread_id)
    StringCodec.encode(buf, name)
    DataCodec.encode(buf, key, True)
    return OutboundMessage(buf, False)
 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)
Пример #10
0
def encode_request(name, local_only):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    FixSizedTypesCodec.encode_boolean(buf, _REQUEST_LOCAL_ONLY_OFFSET,
                                      local_only)
    StringCodec.encode(buf, name, True)
    return OutboundMessage(buf, False)
Пример #11
0
def encode_request(transaction_id, thread_id):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE, True)
    FixSizedTypesCodec.encode_uuid(buf, _REQUEST_TRANSACTION_ID_OFFSET,
                                   transaction_id)
    FixSizedTypesCodec.encode_long(buf, _REQUEST_THREAD_ID_OFFSET, thread_id)
    return OutboundMessage(buf, False)
Пример #12
0
def encode_request(name, timeout_millis):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    FixSizedTypesCodec.encode_long(buf, _REQUEST_TIMEOUT_MILLIS_OFFSET,
                                   timeout_millis)
    StringCodec.encode(buf, name, True)
    return OutboundMessage(buf, False)
def encode_request(timestamp, client_attributes, metrics_blob):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    FixSizedTypesCodec.encode_long(buf, _REQUEST_TIMESTAMP_OFFSET, timestamp)
    StringCodec.encode(buf, client_attributes)
    ByteArrayCodec.encode(buf, metrics_blob, True)
    return OutboundMessage(buf, False)
Пример #14
0
def encode_request(name, _from, to):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    FixSizedTypesCodec.encode_int(buf, _REQUEST_FROM_OFFSET, _from)
    FixSizedTypesCodec.encode_int(buf, _REQUEST_TO_OFFSET, to)
    StringCodec.encode(buf, name, True)
    return OutboundMessage(buf, True)
def encode_request(group_id, name, permits):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    FixSizedTypesCodec.encode_int(buf, _REQUEST_PERMITS_OFFSET, permits)
    RaftGroupIdCodec.encode(buf, group_id)
    StringCodec.encode(buf, name, True)
    return OutboundMessage(buf, True)
Пример #16
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
Пример #17
0
def encode_request(group_id, name, expected, updated):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    FixSizedTypesCodec.encode_long(buf, _REQUEST_EXPECTED_OFFSET, expected)
    FixSizedTypesCodec.encode_long(buf, _REQUEST_UPDATED_OFFSET, updated)
    RaftGroupIdCodec.encode(buf, group_id)
    StringCodec.encode(buf, name, True)
    return OutboundMessage(buf, False)
def encode_request(name, replace_existing_values):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    FixSizedTypesCodec.encode_boolean(buf,
                                      _REQUEST_REPLACE_EXISTING_VALUES_OFFSET,
                                      replace_existing_values)
    StringCodec.encode(buf, name, True)
    return OutboundMessage(buf, False)
def encode_request(name, value_list, overflow_policy):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    FixSizedTypesCodec.encode_int(buf, _REQUEST_OVERFLOW_POLICY_OFFSET,
                                  overflow_policy)
    StringCodec.encode(buf, name)
    ListMultiFrameCodec.encode(buf, value_list, DataCodec.encode, True)
    return OutboundMessage(buf, False)
 def encode(buf, bitmap_index_options, is_final=False):
     initial_frame_buf = create_initial_buffer_custom(_INITIAL_FRAME_SIZE)
     FixSizedTypesCodec.encode_int(initial_frame_buf, _UNIQUE_KEY_TRANSFORMATION_ENCODE_OFFSET, bitmap_index_options.unique_key_transformation)
     buf.extend(initial_frame_buf)
     StringCodec.encode(buf, bitmap_index_options.unique_key)
     if is_final:
         buf.extend(END_FINAL_FRAME_BUF)
     else:
         buf.extend(END_FRAME_BUF)
Пример #21
0
 def encode(buf, address, is_final=False):
     initial_frame_buf = create_initial_buffer_custom(_INITIAL_FRAME_SIZE)
     FixSizedTypesCodec.encode_int(initial_frame_buf, _PORT_ENCODE_OFFSET, address.port)
     buf.extend(initial_frame_buf)
     StringCodec.encode(buf, address.host)
     if is_final:
         buf.extend(END_FINAL_FRAME_BUF)
     else:
         buf.extend(END_FRAME_BUF)
Пример #22
0
def encode_request(group_id, name, new_value, return_old_value):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    FixSizedTypesCodec.encode_boolean(buf, _REQUEST_RETURN_OLD_VALUE_OFFSET,
                                      return_old_value)
    RaftGroupIdCodec.encode(buf, group_id)
    StringCodec.encode(buf, name)
    CodecUtil.encode_nullable(buf, new_value, DataCodec.encode, True)
    return OutboundMessage(buf, False)
Пример #23
0
def encode_request(name, entries, trigger_map_loader):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    FixSizedTypesCodec.encode_boolean(buf, _REQUEST_TRIGGER_MAP_LOADER_OFFSET,
                                      trigger_map_loader)
    StringCodec.encode(buf, name)
    EntryListCodec.encode(buf, entries, DataCodec.encode, DataCodec.encode,
                          True)
    return OutboundMessage(buf, False)
def encode_request(group_id, name, invocation_uid, timeout_ms):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    FixSizedTypesCodec.encode_uuid(buf, _REQUEST_INVOCATION_UID_OFFSET,
                                   invocation_uid)
    FixSizedTypesCodec.encode_long(buf, _REQUEST_TIMEOUT_MS_OFFSET, timeout_ms)
    RaftGroupIdCodec.encode(buf, group_id)
    StringCodec.encode(buf, name, True)
    return OutboundMessage(buf, True)
 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)
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
def encode_request(group_id, name, function, return_value_type):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    FixSizedTypesCodec.encode_int(buf, _REQUEST_RETURN_VALUE_TYPE_OFFSET,
                                  return_value_type)
    RaftGroupIdCodec.encode(buf, group_id)
    StringCodec.encode(buf, name)
    DataCodec.encode(buf, function, True)
    return OutboundMessage(buf, False)
Пример #28
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
Пример #29
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)
Пример #30
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