I had the idea for this a long time ago but I was more focused on getting the system more architecturally sound before moving to other use-case "features".
This is (roughly) how it work work:
In Master:
messenger = Messenger()
messenger.add_hooks(Compress, Encrypt)
The hooks will be applied in that order ... first Compress and then Encrypt.
In Messenger:
def add_hooks(hooks):
for hook in hooks:
self.hooks.append(hook())
def send(msg):
...
for hook in self.hooks:
msg = hook.apply(msg)
...
I had the idea for this a long time ago but I was more focused on getting the system more architecturally sound before moving to other use-case "features".
This is (roughly) how it work work:
In
Master:The hooks will be applied in that order ... first
Compressand thenEncrypt.In
Messenger: