Open jordic opened 4 years ago
Use the pg_notify functionality to trigger the invalidation notices on objects, and propagate them to internal instance caches.
I think this should be implemented outside the pg storage, like the RedisDriver https://github.com/plone/guillotina/blob/master/guillotina/contrib/redis/driver.py. I can't see where's defined the "IPubSubDriver" interface, but should be something like:
async def subscribe(self, channel_name: str, rid: str, callback: Callable[[str], None]):
async def unsubscribe(self, channel_name: str, req_id: str):
async def publish(self, channel_name: str, rid: str, data: Any):
we could consider parent objects has "shadow" like objects in this kind of traversal scheme. If we are serializing permissions to pg somehow, maybe the query to get all parents should not get the "pickle" data and just the zoid, id, parent_id and security. It would break __parent__
APIs so we'd need to change how parent pointers were used.
I agree. We could experiment with others. (there is even json pickle if we want to be lazy)
agreed. Should it be column? Or some sort of table relation? Should we just bite the bullet and just require pg at this point and not try to be "pluggable"?
pg_notify is neat that we don't need another system. I guess this can be "plugged" into like the other pub/sub implementations. It would be nice to have a pubsub implementation that was using pg.
About the first point @jordic , I suggest to start adding a method to the storage interface to load the objects given a path. With this change, we can reimplement navigate_to
in constant-time. When we validate the performance improvement maybe we can change the traversal too
Serve this as a discussion for some proposals to the postgresql datastore driver:
https://gist.github.com/jordic/47502dd92e4b4b32a5b7751bb60533cc
Make IWriter and IReader (for the datastore) serializable without using pickles. That's the only thing I personally don't like around guillotina, using a python only marshaller, makes things less open.
A bit related to the first one, extract security information to a custom column. (could be a json field), something like this will allow us to improve the speed of traversal, and also, could be used on the postgres search feature.
Use the pg_notify functionality to trigger the invalidation notices on objects, and propagate them to internal instance caches.