From 754627b1fbb0b569c05641bc4c4971033c49e9f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl> Date: Wed, 13 Nov 2024 14:36:57 +0100 Subject: [PATCH] argumentify added --- coolamqp/attaches/consumer.py | 28 +++++++++++++--------------- coolamqp/clustering/cluster.py | 4 +++- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/coolamqp/attaches/consumer.py b/coolamqp/attaches/consumer.py index dae02c0..d75e753 100644 --- a/coolamqp/attaches/consumer.py +++ b/coolamqp/attaches/consumer.py @@ -26,21 +26,19 @@ EMPTY_MEMORYVIEW = memoryview(b'') # for empty messages class BodyReceiveMode(object): - # ZC - zero copy - # C - copy (copies every byte once) - - BYTES = 0 # message.body will be a single bytes object - # this will gather frames as memoryviews, and b''.join() them upon - # receiving last frame - # this is C - - MEMORYVIEW = 1 # message.body will be returned as a memoryview object - # this is ZC for small messages, and C for multi-frame ones - # think less than 800B, since 2048 is the buffer for socket recv, and an - # AMQP frame (or many frames!) have to fit there - - LIST_OF_MEMORYVIEW = 2 # message.body will be returned as list of - # memoryview objects these constitute received pieces. this is always ZC + #: # message.body will be a single bytes object + #: this will gather frames as memoryviews, and b''.join() them upon receiving last frame + BYTES = 0 + + #: message.body will be returned as a memoryview object. This is zero-copy for small messages and once-copy for + #: bigger ones + #: think less than 800B, since 2048 is the buffer for socket recv, and an + #: AMQP frame (or many frames!) have to fit there + MEMORYVIEW = 1 + + #: message.body will be returned as list of memoryviews. memoryview objects these constitute received pieces. + #: this is fastest, and always zero-copy + LIST_OF_MEMORYVIEW = 2 class Consumer(Channeler): diff --git a/coolamqp/clustering/cluster.py b/coolamqp/clustering/cluster.py index 3930577..f1e7342 100644 --- a/coolamqp/clustering/cluster.py +++ b/coolamqp/clustering/cluster.py @@ -195,6 +195,8 @@ class Cluster(object): .. note:: You don't need to explicitly declare queues and exchanges that you will be using beforehand, this will do this for you on the same channel. + If accepts more arguments. Consult :class:`coolamqp.attaches.consumer.Consumer` for details. + :param queue: Queue object, being consumed from right now. Note that name of anonymous queue might change at any time! :param on_message: callable that will process incoming messages @@ -261,7 +263,7 @@ class Cluster(object): it will be discarded :param span: optionally, current span, if opentracing is installed :param dont_trace: if set to True, a span won't be generated - :return: Future to be finished on completion or None, is confirm/tx was not chosen + :return: Future to be finished on completion or None, is confirm was not chosen """ if self.tracer is not None and not dont_trace: span = self._make_span('publish', span) -- GitLab