The zaqar.storage.redis.utils
module¶
-
class
SubscriptionListCursor
(client, subscriptions, denormalizer)¶ Bases:
object
-
next
(*args, **kwargs)¶
-
-
descope_message_ids_set
(msgset_key)¶ Descope messages set with ‘.’
Returns: (queue, project)
-
descope_queue_name
(scoped_name)¶ Descope Queue name with ‘.’.
Returns the queue name from the scoped name which is of the form project-id.queue-name
-
descope_subscription_ids_set
(subset_key)¶ Descope subscriptions set with ‘.’
Returns: (queue, project)
-
msg_claimed_filter
(message, now)¶ Return True IFF the message is currently claimed.
-
msg_echo_filter
(message, client_uuid)¶ Return True IFF the specified client posted the message.
-
msg_expired_filter
(message, now)¶ Return True IFF the message has expired.
-
msgset_key
(queue, project=None)¶
-
normalize_none_str
(string_or_none)¶ Returns ” IFF given value is None, passthrough otherwise.
This function normalizes None to the empty string to facilitate string concatenation when a variable could be None.
-
raises_conn_error
(func)¶ Handles the Redis ConnectionFailure error.
This decorator catches Redis’s ConnectionError and raises Zaqar’s ConnectionError instead.
-
retries_on_connection_error
(func)¶ Causes the wrapped function to be re-called on ConnectionError.
This decorator catches Redis ConnectionError and retries the function call.
Note
Assumes that the decorated function has defined self.driver.redis_cinf so that max_reconnect_attempts and reconnect_sleep can be taken into account.
Warning
The decorated function must be idempotent.
-
scope_claim_messages
(queue=None, project=None)¶ Returns a scoped name for a queue based on project and queue.
If only the project name is specified, a scope signifying “all queues” for that project is returned. If neither queue nor project are specified, a scope for “all global queues” is returned, which is to be interpreted as excluding queues scoped by project.
Returns: ‘{project}.{queue}’ if project and queue are given, ‘{project}.’ if ONLY project is given, ‘.{queue}’ if ONLY queue is given, and ‘.’ if neither are given.
-
scope_claims_set
(queue=None, project=None, message_suffix=”)¶ Scope messages set with ‘.’
Returns a scoped name for the list of messages in the form project-id_queue-name_suffix
-
scope_message_ids_set
(queue=None, project=None, message_suffix=”)¶ Scope messages set with ‘.’
Returns a scoped name for the list of messages in the form project-id_queue-name_suffix
-
scope_pool_catalogue
(queue=None, project=None)¶ Returns a scoped name for a queue based on project and queue.
If only the project name is specified, a scope signifying “all queues” for that project is returned. If neither queue nor project are specified, a scope for “all global queues” is returned, which is to be interpreted as excluding queues scoped by project.
Returns: ‘{project}.{queue}’ if project and queue are given, ‘{project}.’ if ONLY project is given, ‘.{queue}’ if ONLY queue is given, and ‘.’ if neither are given.
-
scope_queue_catalogue
(queue=None, project=None, message_suffix=”)¶ Scope messages set with ‘.’
Returns a scoped name for the list of messages in the form project-id_queue-name_suffix
-
scope_queue_index
(queue=None, project=None, message_suffix=”)¶ Scope messages set with ‘.’
Returns a scoped name for the list of messages in the form project-id_queue-name_suffix
-
scope_queue_name
(queue=None, project=None)¶ Returns a scoped name for a queue based on project and queue.
If only the project name is specified, a scope signifying “all queues” for that project is returned. If neither queue nor project are specified, a scope for “all global queues” is returned, which is to be interpreted as excluding queues scoped by project.
Returns: ‘{project}.{queue}’ if project and queue are given, ‘{project}.’ if ONLY project is given, ‘.{queue}’ if ONLY queue is given, and ‘.’ if neither are given.
-
scope_subscription_ids_set
(queue=None, project=None, subscription_suffix=”)¶ Scope subscriptions set with ‘.’
Returns a scoped name for the list of subscriptions in the form project-id_queue-name_suffix
-
subset_key
(queue, project=None)¶