Skip to content

Commit

Permalink
documentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
thefab committed Feb 28, 2015
1 parent fc80b66 commit 223af81
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 18 deletions.
26 changes: 11 additions & 15 deletions tornadis/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ class Client(object):
read_page_size (int): page size for reading.
write_page_size (int): page size for writing.
connect_timeout (int): timeout (in seconds) for connecting.
subscribed (boolean): True if the client is in subscription mode
__callback_queue (collections.deque): FIXME
_reply_list (list): FXME
__reader: hiredis reader object.
subscribed (boolean): True if the client is in subscription mode.
"""

def __init__(self, host=tornadis.DEFAULT_HOST, port=tornadis.DEFAULT_PORT,
Expand All @@ -51,7 +48,6 @@ def __init__(self, host=tornadis.DEFAULT_HOST, port=tornadis.DEFAULT_PORT,
write_page_size (int): page size for writing.
connect_timeout (int): timeout (in seconds) for connecting.
ioloop (IOLoop): the tornado ioloop to use.
ioloop (IOLoop): the tornado ioloop to use.
"""
self.host = host
self.port = port
Expand Down Expand Up @@ -85,8 +81,8 @@ def connect(self):
a Future object with no result.
Raises:
ConnectionError: when there is a connection error
ClientError: when you are already connected
ConnectionError: when there is a connection error.
ClientError: when you are already connected.
"""
if self.is_connected():
raise ClientError("you are already connected")
Expand All @@ -108,7 +104,7 @@ def disconnect(self):
It's safe to use this method even if you are already disconnected.
Returns:
a Future object with undetermined result
a Future object with undetermined result.
"""
if not self.is_connected():
return
Expand Down Expand Up @@ -157,30 +153,30 @@ def _read_callback(self, data=None):
break

def call(self, *args, **kwargs):
"""Calls a redis command and waits for the reply
"""Calls a redis command and waits for the reply.
Following options are available (not part of the redis command itself):
- callback
Function called (with the result as argument) when the
future resolves (standard behavior of the tornado.gen.coroutine
decorator => do not yield the returned Future when you use a
callback argument)
callback argument).
- discard_reply
If True (default False), don't wait for completion
and discard the reply (when it becomes available) => do not
yield the returned Future and don't use together with callback
option
option.
Args:
*args: full redis command as variable length argument list
**kwargs: options as keyword parameters
*args: full redis command as variable length argument list.
**kwargs: options as keyword parameters.
Returns:
a Future with the decoded redis reply as result
a Future with the decoded redis reply as result.
Raises:
ClientError: you are not connected
ClientError: you are not connected.
Examples:
Expand Down
6 changes: 3 additions & 3 deletions tornadis/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def __init__(self, read_callback, close_callback,
"""Constructor.
Args:
read_callback: FIXME
close_callback: FIXME
read_callback: callback called when there is something to read.
close_callback: callback called when the connection is closed.
host (string): the host name to connect to.
port (int): the port to connect to.
read_page_size (int): page size for reading.
Expand Down Expand Up @@ -99,7 +99,7 @@ def connect(self):
Future: a Future object with no specific result.
Raises:
ConnectionError: when there is a connection error
ConnectionError: when there is a connection error.
"""
self._ensure_not_connected()
self.__socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
Expand Down
14 changes: 14 additions & 0 deletions tornadis/pubsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@


class PubSubClient(Client):
"""High level specific object to interact with pubsub redis.
The call() method is forbidden with this object.
More informations on the redis side: http://redis.io/topics/pubsub
Attributes:
host (string): the host name to connect to.
port (int): the port to connect to.
read_page_size (int): page size for reading.
write_page_size (int): page size for writing.
connect_timeout (int): timeout (in seconds) for connecting.
subscribed (boolean): True if the client is in subscription mode.
"""

def call(self, *args, **kwargs):
raise ClientError("not allowed with PubSubClient object")
Expand Down

0 comments on commit 223af81

Please sign in to comment.