Commit graph libervia-backend/sat/plugins/plugin_pubsub_cache.py
Author SHA1 Message Date
Goffi
6a6f15707a massive refactoring to switch from camelCase to snake_case:
historically, Libervia (SàT before) was using camelCase as allowed by PEP8 when using a
pre-PEP8 code, to use the same coding style as in Twisted.

However, snake_case is more readable and it's better to follow PEP8 best practices, so it
has been decided to move on full snake_case. Because Libervia has a huge codebase, this
ended with a ugly mix of camelCase and snake_case.

To fix that, this patch does a big refactoring by renaming every function and method
(including bridge) that are not coming from Twisted or Wokkel, to use fully snake_case.

This is a massive change, and may result in some bugs.
2023-04-08 13:54:42 +02:00
Goffi
dbbdcd04bb plugin pubsub cache: avoid race condition by retrying node request:
When retrieving items, there may be a race condition if a node is not found in cache, then
created before `setPubsubNode` is called. This patch handle this case by retrying in case
of UNIQUE constraint violation.
2022-10-15 20:38:33 +02:00
Goffi
da9725479b plugin OXPS: OpenPGP for XMPP Pubsub implementation:
OpenPGP for XMPP Pubsub (https://xmpp.org/extensions/inbox/pubsub-encryption.html,
currently a protoXEP) is implemented and activated when `encrypted` is set to `True` in
pubsub's `extra` data.

On item retrieval, the decryption is transparent if the key is known, except if the
`decrypt` key in `extra` is set to `False` (notably useful when one wants to checks that
data is well encrypted).

Methods and corresponding bridge methods have been implemented to manage shared secrets
(to share, revoke or rotate the secrets).

plugin XEP-0060's `XEP-0060_publish` trigger point as been move before actual publish so
item can be modified (here e2ee) by the triggers. A new `XEP-0060_items` trigger point has
also been added.

`encrypted` flag can be used with plugin XEP-0277's microblog data

rel 380
2022-10-15 20:36:53 +02:00
Goffi
60a747b6f8 plugin pubsub cache: replace empty list by None in getItemsFromCache:
if an empty list is used, no item can be retrieved, this patch replace empty list by None
to avoid this case.
2022-07-20 17:46:58 +02:00
Goffi
5ceb75a137 plugin XEP-0060: fix bad naming of return variable 2022-07-14 12:55:30 +02:00
Goffi
a626b8b888 plugin pubsub cache: resync in synchronise when node's sync_state is not set:
synchronisation used to be skipped when the node was existing and `resync` was not set,
however the case happens when a node is subscribed but not synchronised, thus this patch
update the behaviour to be sure to have the node synchronised.

rel 369
2022-07-10 15:16:15 +02:00
Goffi
ab2f9661d1 plugin pubsub cache: new resync argument to force resynchronisation in synchronize 2022-05-13 18:44:54 +02:00
Goffi
4e441258b3 plugin pubsub cache: more resilient node caching:
- cache only latest 20 items when disco infos are hidden and thus we can't discover
  feature/RSM implementation
- better handling of args when calling `storage.getItems`

rel 365
2022-05-13 18:43:42 +02:00
Goffi
0112d503ff plugin XEP-0059, cache: allow those plugins to work in component mode
rel 364
2022-03-22 17:00:42 +01:00
Goffi
d2ae4a124a plugin pubsub cache: implement psCacheSearch
rel 361
2021-09-08 17:58:48 +02:00
Goffi
6fa6f7a1f8 plugin pubsub cache: use asDeferred with match_cb 2021-08-02 21:52:17 +02:00
Goffi
92c0c09eb2 plugin pubsub cache: Pubsub Caching implementation 2021-07-29 22:51:01 +02:00