def __init__(self, read_callback, close_callback,
                 host=tornadis.DEFAULT_HOST,
                 port=tornadis.DEFAULT_PORT, unix_domain_socket=None,
                 read_page_size=tornadis.DEFAULT_READ_PAGE_SIZE,
                 write_page_size=tornadis.DEFAULT_WRITE_PAGE_SIZE,
                 connect_timeout=tornadis.DEFAULT_CONNECT_TIMEOUT,
                 tcp_nodelay=False, aggressive_write=False,
                 read_timeout=tornadis.DEFAULT_READ_TIMEOUT,
                 ioloop=None):
        """Constructor.

        Args:
            read_callback: callback called when there is something to read
                (private, do not use from Client constructor).
            close_callback: callback called when the connection is closed
                (private, do not use from Client constructor).
            host (string): the host name to connect to.
            port (int): the port to connect to.
            unix_domain_socket (string): path to a unix socket to connect to
                (if set, overrides host/port parameters).
            read_page_size (int): page size for reading.
            write_page_size (int): page size for writing.
            connect_timeout (int): timeout (in seconds) for connecting.
            tcp_nodelay (boolean): set TCP_NODELAY on socket.
            aggressive_write (boolean): try to minimize write latency over
                global throughput (default False).
            read_timeout (int): timeout (in seconds) to read something on
                the socket (if nothing is read during this time, the
                connection is closed) (default: 0 means no timeout)
            ioloop (IOLoop): the tornado ioloop to use.
        """
        self.host = host
        self.port = port
        self.unix_domain_socket = unix_domain_socket
        self._state = ConnectionState()
        self._ioloop = ioloop or tornado.ioloop.IOLoop.instance()
        if int(tornado.version[0]) >= 5:
            cb = tornado.ioloop.PeriodicCallback(self._on_every_second, 1000)
        else:
            cb = tornado.ioloop.PeriodicCallback(self._on_every_second, 1000,
                                                 self._ioloop)
        self.__periodic_callback = cb
        self._read_callback = read_callback
        self._close_callback = close_callback
        self.read_page_size = read_page_size
        self.write_page_size = write_page_size
        self.connect_timeout = connect_timeout
        self.read_timeout = read_timeout
        self.tcp_nodelay = tcp_nodelay
        self.aggressive_write = aggressive_write
        self._write_buffer = WriteBuffer()
        self._listened_events = 0
        self._last_read = datetime.now()
def __init__ ( self , read_callback , close_callback , host = tornadis . DEFAULT_HOST , port = tornadis . DEFAULT_PORT , unix_domain_socket = None , read_page_size = tornadis . DEFAULT_READ_PAGE_SIZE , write_page_size = tornadis . DEFAULT_WRITE_PAGE_SIZE , connect_timeout = tornadis . DEFAULT_CONNECT_TIMEOUT , tcp_nodelay = False , aggressive_write = False , read_timeout = tornadis . DEFAULT_READ_TIMEOUT , ioloop = None ) : self . host = host self . port = port self . unix_domain_socket = unix_domain_socket self . _state = ConnectionState ( ) self . _ioloop = ioloop or tornado . ioloop . IOLoop . instance ( ) if int ( tornado . version [ 0 ] ) >= 5 : cb = tornado . ioloop . PeriodicCallback ( self . _on_every_second , 1000 ) else : cb = tornado . ioloop . PeriodicCallback ( self . _on_every_second , 1000 , self . _ioloop ) self . __periodic_callback = cb self . _read_callback = read_callback self . _close_callback = close_callback self . read_page_size = read_page_size self . write_page_size = write_page_size self . connect_timeout = connect_timeout self . read_timeout = read_timeout self . tcp_nodelay = tcp_nodelay self . aggressive_write = aggressive_write self . _write_buffer = WriteBuffer ( ) self . _listened_events = 0 self . _last_read = datetime . now ( )
Constructor.

        Args:
            read_callback: callback called when there is something to read
                (private, do not use from Client constructor).
            close_callback: callback called when the connection is closed
                (private, do not use from Client constructor).
            host (string): the host name to connect to.
            port (int): the port to connect to.
            unix_domain_socket (string): path to a unix socket to connect to
                (if set, overrides host/port parameters).
            read_page_size (int): page size for reading.
            write_page_size (int): page size for writing.
            connect_timeout (int): timeout (in seconds) for connecting.
            tcp_nodelay (boolean): set TCP_NODELAY on socket.
            aggressive_write (boolean): try to minimize write latency over
                global throughput (default False).
            read_timeout (int): timeout (in seconds) to read something on
                the socket (if nothing is read during this time, the
                connection is closed) (default: 0 means no timeout)
            ioloop (IOLoop): the tornado ioloop to use.