def encode_request(name, replica_timestamps, target_replica):
    """ Encode request into client_message"""
    client_message = ClientMessage(payload_size=calculate_size(name, replica_timestamps, target_replica))
    client_message.set_message_type(REQUEST_TYPE)
    client_message.set_retryable(RETRYABLE)
    client_message.append_str(name)
    client_message.append_int(len(replica_timestamps))
    for replica_timestamps_item in replica_timestamps:
        key = replica_timestamps_item[0]
        val = replica_timestamps_item[1]
        client_message.append_str(key)
        client_message.append_long(val)

    AddressCodec.encode(client_message, target_replica)
    client_message.update_frame_length()
    return client_message
def encode_request ( name , replica_timestamps , target_replica ) : client_message = ClientMessage ( payload_size = calculate_size ( name , replica_timestamps , target_replica ) ) client_message . set_message_type ( REQUEST_TYPE ) client_message . set_retryable ( RETRYABLE ) client_message . append_str ( name ) client_message . append_int ( len ( replica_timestamps ) ) for replica_timestamps_item in replica_timestamps : key = replica_timestamps_item [ 0 ] val = replica_timestamps_item [ 1 ] client_message . append_str ( key ) client_message . append_long ( val ) AddressCodec . encode ( client_message , target_replica ) client_message . update_frame_length ( ) return client_message
Encode request into client_message