Skip to content

Commit 02be9f4

Browse files
committed
Add some API documentation for Cython-based deserializers
1 parent 9240c71 commit 02be9f4

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

cassandra/protocol.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ class ProtocolHandler(object):
894894
result decoding implementations.
895895
"""
896896

897-
@classmethod
897+
@classmethod
898898
def encode_message(cls, msg, stream_id, protocol_version, compressor):
899899
"""
900900
Encodes a message using the specified frame parameters, and compressor

docs/api/cassandra/protocol.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,17 @@ See :meth:`.Session.execute`, ::meth:`.Session.execute_async`, :attr:`.ResponseF
2424
.. automethod:: encode_message
2525

2626
.. automethod:: decode_message
27+
28+
Faster Deserialization
29+
----------------------
30+
When python-driver is compiled with Cython, it uses a Cython-based deserialization path
31+
to deserialize messages. There are two additional ProtocolHandler classes that can be
32+
used to deserialize response messages: the first is ``LazyProtocolHandler`` and the
33+
second is ``NumpyProtocolHandler``.They can be used as follows:
34+
35+
.. code:: python
36+
37+
from cassandra.protocol import NumpyProtocolHandler, LazyProtocolHandler
38+
s.client_protocol_handler = LazyProtocolHandler # for a result iterator
39+
s.client_protocol_handler = NumpyProtocolHandler # for a dict of NumPy arrays as result
40+

0 commit comments

Comments
 (0)