comparison libervia/backend/plugins/plugin_pubsub_cache.py @ 4249:ba46d6a0ff3a

doc: style/typos/URL fixes
author Goffi <goffi@goffi.org>
date Fri, 31 May 2024 11:08:20 +0200
parents 2b000790b197
children 0d7bb4df2343
comparison
equal deleted inserted replaced
4248:00852dd54695 4249:ba46d6a0ff3a
134 134
135 @param analyser: An analyser is a dictionary which may have the following keys 135 @param analyser: An analyser is a dictionary which may have the following keys
136 (keys with a ``*`` are mandatory, at least one of ``node`` or ``namespace`` keys 136 (keys with a ``*`` are mandatory, at least one of ``node`` or ``namespace`` keys
137 must be used): 137 must be used):
138 138
139 :name (str)*: 139 name (str)*
140 a unique name for this analyser. This name will be stored in database 140 a unique name for this analyser. This name will be stored in database
141 to retrieve the analyser when necessary (notably to get the parsing method), 141 to retrieve the analyser when necessary (notably to get the parsing method),
142 thus it is recommended to use a stable name such as the source plugin name 142 thus it is recommended to use a stable name such as the source plugin name
143 instead of a name which may change with standard evolution, such as the 143 instead of a name which may change with standard evolution, such as the
144 feature namespace. 144 feature namespace.
145 145
146 :type (str)*: 146 type (str)*
147 indicates what kind of items we are dealing with. Type must be a human 147 indicates what kind of items we are dealing with. Type must be a human
148 readable word, as it may be used in searches. Good types examples are 148 readable word, as it may be used in searches. Good types examples are
149 **blog** or **event**. 149 **blog** or **event**.
150 150
151 :node (str): 151 node (str)
152 prefix of a node name which may be used to identify its type. Example: 152 prefix of a node name which may be used to identify its type. Example:
153 *urn:xmpp:microblog:0* (a node starting with this name will be identified as 153 *urnxmpp:microblog0* (a node starting with this name will be identified as
154 *blog* node). 154 *blog* node).
155 155
156 :namespace (str): 156 namespace (str)
157 root namespace of items. When analysing a node, the first item will be 157 root namespace of items. When analysing a node, the first item will be
158 retrieved. The analyser will be chosen its given namespace match the 158 retrieved. The analyser will be chosen its given namespace match the
159 namespace of the first child element of ``<item>`` element. 159 namespace of the first child element of ``<item>`` element.
160 160
161 :to_sync (bool): 161 to_sync (bool)
162 if True, the node must be synchronised in cache. The default False value 162 if True, the node must be synchronised in cache. The default False value
163 means that the pubsub service will always be requested. 163 means that the pubsub service will always be requested.
164 164
165 :parser (callable): 165 parser (callable)
166 method (which may be sync, a coroutine or a method returning a "Deferred") 166 method (which may be sync, a coroutine or a method returning a "Deferred")
167 to call to parse the ``domish.Element`` of the item. The result must be 167 to call to parse the ``domish.Element`` of the item. The result must be
168 dictionary which can be serialised to JSON. 168 dictionary which can be serialised to JSON.
169 169
170 The method must have the following signature: 170 The method must have the following signature:
172 .. function:: parser(client: SatXMPPEntity, item_elt: domish.Element, \ 172 .. function:: parser(client: SatXMPPEntity, item_elt: domish.Element, \
173 service: Optional[jid.JID], node: Optional[str]) \ 173 service: Optional[jid.JID], node: Optional[str]) \
174 -> dict 174 -> dict
175 :noindex: 175 :noindex:
176 176
177 :match_cb (callable): 177 match_cb (callable)
178 method (which may be sync, a coroutine or a method returning a "Deferred") 178 method (which may be sync, a coroutine or a method returning a "Deferred")
179 called when the analyser matches. The method is called with the curreny 179 called when the analyser matches. The method is called with the curreny
180 analyse which is can modify **in-place**. 180 analyse which is can modify **in-place**.
181 181
182 The method must have the following signature: 182 The method must have the following signature: