Don't store any PDUs

pull/12/head
Erik Johnston 2014-10-31 09:59:59 +00:00
parent f2de2d644a
commit 841df4da71
2 changed files with 32 additions and 31 deletions

View File

@ -57,7 +57,7 @@ class ReplicationLayer(object):
self.transport_layer.register_request_handler(self) self.transport_layer.register_request_handler(self)
self.store = hs.get_datastore() self.store = hs.get_datastore()
self.pdu_actions = PduActions(self.store) # self.pdu_actions = PduActions(self.store)
self.transaction_actions = TransactionActions(self.store) self.transaction_actions = TransactionActions(self.store)
self._transaction_queue = _TransactionQueue( self._transaction_queue = _TransactionQueue(
@ -278,16 +278,16 @@ class ReplicationLayer(object):
@defer.inlineCallbacks @defer.inlineCallbacks
@log_function @log_function
def on_context_pdus_request(self, context): def on_context_pdus_request(self, context):
pdus = yield self.pdu_actions.get_all_pdus_from_context( raise NotImplementedError(
context "on_context_pdus_request is a security violation"
) )
defer.returnValue((200, self._transaction_from_pdus(pdus).get_dict()))
@defer.inlineCallbacks @defer.inlineCallbacks
@log_function @log_function
def on_backfill_request(self, context, versions, limit): def on_backfill_request(self, context, versions, limit):
pdus = yield self.handler.on_backfill_request(
pdus = yield self.pdu_actions.backfill(context, versions, limit) context, versions, limit
)
defer.returnValue((200, self._transaction_from_pdus(pdus).get_dict())) defer.returnValue((200, self._transaction_from_pdus(pdus).get_dict()))
@ -383,20 +383,22 @@ class ReplicationLayer(object):
@defer.inlineCallbacks @defer.inlineCallbacks
@log_function @log_function
def on_pull_request(self, origin, versions): def on_pull_request(self, origin, versions):
transaction_id = max([int(v) for v in versions]) raise NotImplementedError("Pull transacions not implemented")
response = yield self.pdu_actions.after_transaction( # transaction_id = max([int(v) for v in versions])
transaction_id, #
origin, # response = yield self.pdu_actions.after_transaction(
self.server_name # transaction_id,
) # origin,
# self.server_name
if not response: # )
response = [] #
# if not response:
defer.returnValue( # response = []
(200, self._transaction_from_pdus(response).get_dict()) #
) # defer.returnValue(
# (200, self._transaction_from_pdus(response).get_dict())
# )
@defer.inlineCallbacks @defer.inlineCallbacks
def on_query_request(self, query_type, args): def on_query_request(self, query_type, args):
@ -498,8 +500,7 @@ class ReplicationLayer(object):
state = None state = None
# Get missing pdus if necessary. # Get missing pdus if necessary.
is_new = yield self.pdu_actions.is_new(pdu) if not pdu.outlier:
if is_new and not pdu.outlier:
# We only backfill backwards to the min depth. # We only backfill backwards to the min depth.
min_depth = yield self.store.get_min_depth_for_context(pdu.context) min_depth = yield self.store.get_min_depth_for_context(pdu.context)
@ -539,7 +540,7 @@ class ReplicationLayer(object):
else: else:
ret = None ret = None
yield self.pdu_actions.mark_as_processed(pdu) # yield self.pdu_actions.mark_as_processed(pdu)
defer.returnValue(ret) defer.returnValue(ret)

View File

@ -142,15 +142,15 @@ class TransactionStore(SQLBaseStore):
# Update the tx id -> pdu id mapping # Update the tx id -> pdu id mapping
values = [ # values = [
(transaction_id, destination, pdu[0], pdu[1]) # (transaction_id, destination, pdu[0], pdu[1])
for pdu in pdu_list # for pdu in pdu_list
] # ]
#
logger.debug("Inserting: %s", repr(values)) # logger.debug("Inserting: %s", repr(values))
#
query = TransactionsToPduTable.insert_statement() # query = TransactionsToPduTable.insert_statement()
txn.executemany(query, values) # txn.executemany(query, values)
return prev_txns return prev_txns