<s> from hazelcast . serialization . bits import * <EOL> from hazelcast . protocol . client_message import ClientMessage <EOL> from hazelcast . protocol . custom_codec import * <EOL> from hazelcast . util import ImmutableLazyDataList <EOL> from hazelcast . protocol . codec . atomic_long_message_type import * <EOL> REQUEST_TYPE = ATOMICLONG_APPLY <EOL> RESPONSE_TYPE = <NUM_LIT> <EOL> RETRYABLE = False <EOL> def calculate_size ( name , function ) : <EOL> """<STR_LIT>""" <EOL> data_size = <NUM_LIT:0> <EOL> data_size += calculate_size_str ( name ) <EOL> data_size += calculate_size_data ( function ) <EOL> return data_size <EOL> def encode_request ( name , function ) : <EOL> """<STR_LIT>""" <EOL> client_message = ClientMessage ( payload_size = calculate_size ( name , function ) ) <EOL> client_message . set_message_type ( REQUEST_TYPE ) <EOL> client_message . set_retryable ( RETRYABLE ) <EOL> client_message . append_str ( name ) <EOL> client_message . append_data ( function ) <EOL> client_message . update_frame_length ( ) <EOL> return client_message <EOL> def decode_response ( client_message , to_object = None ) : <EOL> """<STR_LIT>""" <EOL> parameters = dict ( response = None ) <EOL> response = None <EOL> if not client_message . read_bool ( ) : <EOL> parameters [ '<STR_LIT>' ] = to_object ( client_message . read_data ( ) ) <EOL> return parameters </s>
