kafka.net.transport
- class kafka.net.transport.KafkaTCPTransport(net, sock, host=None)[source]
- abort(error=None)[source]
Close the transport immediately.
Buffered data will be lost. No more data will be received. The protocol’s connection_lost() method will (eventually) be called with None as its argument.
- close()[source]
Close the transport.
Buffered data will be flushed asynchronously. No more data will be received. After all buffered data is flushed, the protocol’s connection_lost() method will (eventually) be called with None as its argument.
- getHost()[source]
Similar to getPeer, but returns an address describing this side of the connection.
Returns IPv4Address or IPv6Address.
- getPeer()[source]
Get the remote address of this connection.
Treat this method with caution. It is the unfortunate result of the CGI and Jabber standards, but should not be considered reliable for the usual host of reasons; port forwarding, proxying, firewalls, IP masquerading, etc.
Returns IPv4Address or IPv6Address.
- get_write_buffer_limits()[source]
Get the high and low watermarks for write flow control. Return a tuple (low, high) where low and high are positive number of bytes.
- property last_activity
- loseConnection()[source]
Close my connection, after writing all pending data.
Note that if there is a registered producer on a transport it will not be closed until the producer has been unregistered.
- pause_reading()[source]
Pause the receiving end.
No data will be passed to the protocol’s data_received() method until resume_reading() is called.
- resume_reading()[source]
Resume the receiving end.
Data received will once again be passed to the protocol’s data_received() method.
- set_write_buffer_limits(high=None, low=None)[source]
Set the high- and low-water limits for write flow control.
These two values control when to call the protocol’s pause_writing() and resume_writing() methods. If specified, the low-water limit must be less than or equal to the high-water limit. Neither value can be negative.
The defaults are implementation-specific. If only the high-water limit is given, the low-water limit defaults to an implementation-specific value less than or equal to the high-water limit. Setting high to zero forces low to zero as well, and causes pause_writing() to be called whenever the buffer becomes non-empty. Setting low to zero causes resume_writing() to be called only once the buffer is empty. Use of zero for either limit is generally sub-optimal as it reduces opportunities for doing I/O and computation concurrently.
- write(data)[source]
Write some data bytes to the transport.
This does not block; it buffers the data and arranges for it to be sent out asynchronously.
- writeSequence(data)[source]
Write an iterable of byte strings to the physical connection.
If possible, make sure that all of the data is written to the socket at once, without first copying it all into a single byte string.