<s> """<STR_LIT>""" <EOL> from twisted . internet import defer <EOL> from synapse . util . logutils import log_function <EOL> import logging <EOL> logger = logging . getLogger ( __name__ ) <EOL> class TransactionActions ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , datastore ) : <EOL> self . store = datastore <EOL> @ log_function <EOL> def have_responded ( self , transaction ) : <EOL> """<STR_LIT>""" <EOL> if not transaction . transaction_id : <EOL> raise RuntimeError ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return self . store . get_received_txn_response ( <EOL> transaction . transaction_id , transaction . origin <EOL> ) <EOL> @ log_function <EOL> def set_response ( self , transaction , code , response ) : <EOL> """<STR_LIT>""" <EOL> if not transaction . transaction_id : <EOL> raise RuntimeError ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return self . store . set_received_txn_response ( <EOL> transaction . transaction_id , <EOL> transaction . origin , <EOL> code , <EOL> response , <EOL> ) <EOL> @ defer . inlineCallbacks <EOL> @ log_function <EOL> def prepare_to_send ( self , transaction ) : <EOL> """<STR_LIT>""" <EOL> transaction . prev_ids = yield self . store . prep_send_transaction ( <EOL> transaction . transaction_id , <EOL> transaction . destination , <EOL> transaction . origin_server_ts , <EOL> ) <EOL> @ log_function <EOL> def delivered ( self , transaction , response_code , response_dict ) : <EOL> """<STR_LIT>""" <EOL> return self . store . delivered_txn ( <EOL> transaction . transaction_id , <EOL> transaction . destination , <EOL> response_code , <EOL> response_dict , <EOL> ) </s>
