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