<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 . transactional_set_message_type import * <EOL> REQUEST_TYPE = TRANSACTIONALSET_ADD <EOL> RESPONSE_TYPE = <NUM_LIT> <EOL> RETRYABLE = False <EOL> def calculate_size ( name , txn_id , thread_id , item ) : <EOL> """<STR_LIT>""" <EOL> data_size = <NUM_LIT:0> <EOL> data_size += calculate_size_str ( name ) <EOL> data_size += calculate_size_str ( txn_id ) <EOL> data_size += LONG_SIZE_IN_BYTES <EOL> data_size += calculate_size_data ( item ) <EOL> return data_size <EOL> def encode_request ( name , txn_id , thread_id , item ) : <EOL> """<STR_LIT>""" <EOL> client_message = ClientMessage ( payload_size = calculate_size ( name , txn_id , thread_id , item ) ) <EOL> client_message . set_message_type ( REQUEST_TYPE ) <EOL> client_message . set_retryable ( RETRYABLE ) <EOL> client_message . append_str ( name ) <EOL> client_message . append_str ( txn_id ) <EOL> client_message . append_long ( thread_id ) <EOL> client_message . append_data ( item ) <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> parameters [ '<STR_LIT>' ] = client_message . read_bool ( ) <EOL> return parameters </s>
