Ejemplo n.º 1
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)
Ejemplo n.º 2
0
def encode_request(name, entries):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    StringCodec.encode(buf, name)
    EntryListCodec.encode(buf, entries, DataCodec.encode, DataCodec.encode,
                          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 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)
Ejemplo n.º 5
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)
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(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 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)
Ejemplo n.º 9
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(buf, hazelcast_json_value, is_final=False):
     buf.extend(BEGIN_FRAME_BUF)
     StringCodec.encode(buf, hazelcast_json_value.value)
     if is_final:
         buf.extend(END_FINAL_FRAME_BUF)
     else:
         buf.extend(END_FRAME_BUF)
Ejemplo n.º 11
0
def encode_request(group_id, name, function):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    RaftGroupIdCodec.encode(buf, group_id)
    StringCodec.encode(buf, name)
    DataCodec.encode(buf, function, True)
    return OutboundMessage(buf, False)
 def test_string(self):
     self.mark_initial_frame_as_non_final()
     string = six.u("abc©☺𩸽🐶😁")
     StringCodec.encode(self.buf, string, True)
     message = self.write_and_decode()
     message.next_frame()  # initial frame
     self.assertEqual(string, StringCodec.decode(message))
Ejemplo n.º 13
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)
Ejemplo n.º 14
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)
def encode_request(group_id, service_name, object_name):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    RaftGroupIdCodec.encode(buf, group_id)
    StringCodec.encode(buf, service_name)
    StringCodec.encode(buf, object_name, True)
    return OutboundMessage(buf, True)
def encode_request(name, projection, predicate):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    StringCodec.encode(buf, name)
    DataCodec.encode(buf, projection)
    DataCodec.encode(buf, predicate, True)
    return OutboundMessage(buf, True)
def encode_request(group_id, name, old_value, new_value):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE, _REQUEST_MESSAGE_TYPE)
    RaftGroupIdCodec.encode(buf, group_id)
    StringCodec.encode(buf, name)
    CodecUtil.encode_nullable(buf, old_value, DataCodec.encode)
    CodecUtil.encode_nullable(buf, new_value, DataCodec.encode, True)
    return OutboundMessage(buf, False)
Ejemplo n.º 18
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, 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_request(name, key, include_value, listener_flags, local_only):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE, _REQUEST_MESSAGE_TYPE)
    FixSizedTypesCodec.encode_boolean(buf, _REQUEST_INCLUDE_VALUE_OFFSET, include_value)
    FixSizedTypesCodec.encode_int(buf, _REQUEST_LISTENER_FLAGS_OFFSET, listener_flags)
    FixSizedTypesCodec.encode_boolean(buf, _REQUEST_LOCAL_ONLY_OFFSET, local_only)
    StringCodec.encode(buf, name)
    DataCodec.encode(buf, key, 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)
Ejemplo n.º 22
0
def encode_request(name, txn_id, thread_id, timeout):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE,
                                _REQUEST_MESSAGE_TYPE)
    FixSizedTypesCodec.encode_uuid(buf, _REQUEST_TXN_ID_OFFSET, txn_id)
    FixSizedTypesCodec.encode_long(buf, _REQUEST_THREAD_ID_OFFSET, thread_id)
    FixSizedTypesCodec.encode_long(buf, _REQUEST_TIMEOUT_OFFSET, timeout)
    StringCodec.encode(buf, name, True)
    return OutboundMessage(buf, False)
def encode_request(name, delta, get_before_update, replica_timestamps, target_replica_uuid):
    buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE, _REQUEST_MESSAGE_TYPE)
    FixSizedTypesCodec.encode_long(buf, _REQUEST_DELTA_OFFSET, delta)
    FixSizedTypesCodec.encode_boolean(buf, _REQUEST_GET_BEFORE_UPDATE_OFFSET, get_before_update)
    FixSizedTypesCodec.encode_uuid(buf, _REQUEST_TARGET_REPLICA_UUID_OFFSET, target_replica_uuid)
    StringCodec.encode(buf, name)
    EntryListUUIDLongCodec.encode(buf, replica_timestamps, True)
    return OutboundMessage(buf, False)
Ejemplo n.º 24
0
 def encode(buf, distributed_object_info, is_final=False):
     buf.extend(BEGIN_FRAME_BUF)
     StringCodec.encode(buf, distributed_object_info.service_name)
     StringCodec.encode(buf, distributed_object_info.name)
     if is_final:
         buf.extend(END_FINAL_FRAME_BUF)
     else:
         buf.extend(END_FRAME_BUF)
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)
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)
Ejemplo n.º 27
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)
Ejemplo n.º 28
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)
Ejemplo n.º 29
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)
Ejemplo n.º 30
0
 def encode(buf, schema, is_final=False):
     buf.extend(BEGIN_FRAME_BUF)
     StringCodec.encode(buf, schema.type_name)
     ListMultiFrameCodec.encode(buf, schema.fields_list,
                                FieldDescriptorCodec.encode)
     if is_final:
         buf.extend(END_FINAL_FRAME_BUF)
     else:
         buf.extend(END_FRAME_BUF)