refactor: According to RFC 116: Updated the type of index key.

This commit is contained in:
莘权 马 2023-11-08 20:36:42 +08:00
parent c18bc7c876
commit 09fe4593f6

View file

@ -26,10 +26,8 @@ class Memory:
if message in self.storage:
return
self.storage.append(message)
# According to the design of RFC 116, it allows message filtering based on different labels, thus
# necessitating the creation of separate indices for each label.
for k in message.msg_to:
self.index[k].append(message)
if message.cause_by:
self.index[message.cause_by].append(message)
def add_batch(self, messages: Iterable[Message]):
for message in messages: