class Transport(object):
Low-level transport class.
This is used on the client side.
This could be replaced by any other class that provides the same semantics to the Client. This means:
- can send messages and receive messages
- safe for multithreading
Static Method |
|
Calls a given function, retrying if it fails on a network IO exception. |
Method | __init__ |
Constructor for the Client class. |
Method |
|
Send a message and wait for the response. |
Method |
|
Close the socket |
Method |
|
Try to receive a message from the socket. |
Method |
|
Send a message. |
Instance Variable | address |
Undocumented |
Instance Variable | socket |
Undocumented |
Static Method | _ |
Undocumented |
Method | _ |
Make sure we are connected. |
Instance Variable | _buffer |
Undocumented |
Instance Variable | _ctimeout |
Undocumented |
Instance Variable | _msgs |
Undocumented |
Instance Variable | _rwtimeout |
Undocumented |
Calls a given function, retrying if it fails on a network IO exception.
This allows to re-establish a broken connection and retry an IO operation.
The function receives one an integer argument stating the current retry number, 0 being the first call, 1 being the first retry, 2 the second, and so on.
If any exception occurs, on_error is invoked first with the exception given as an argument. Then, if the exception is a network exception, the function call is retried once more.
Constructor for the Client class.
There are two timeouts used since we might want to wait for a long time for a response, but the connect timeout should be lower.
If not passed, we use the default luxi timeouts from the global constants file.
Note that on reading data, since the timeout applies to an invidual receive, it might be that the total duration is longer than timeout value passed (we make a hard limit at twice the read timeout).
Parameters | |
address:socket address | address the transport connects to |
timeouts:list of ints | timeouts to be used on connect and read/write |
allow | skip checks for the master node on errors |