Module etcd-client.client.pool
Pool of clients for etcd.
Instance methods
| instance.request (self, location, req) | Send the request to a client. |
| instance.stream (self, location) | Create a stream to a client. |
| instance.close (self) | Close a client pool. |
| instance.add (self, clients) | Add clients to the pool. |
| instance.remove (self, clients) | Remove clients from the pool. |
| new (clients) | Create a new pool client instance. |
Instance methods
- instance.request (self, location, req)
-
Send the request to a client.
In the pool implementation it switches to a next client if the request failed with a transient error (as example, server is unavailable).
Parameters:
- self
Pool instance.
- location
(string)
A target location.
- req
(string)
Request body.
Returns:
- true, response
- false, etcd-client.error.http.HttpError or etcd-client.error.etcd.EtcdError.
- self
- instance.stream (self, location)
-
Create a stream to a client.
In the pool implementation it switches to a next client if the request failed with a transient error (as example, server is unavailable).
Parameters:
- self
Pool instance.
- location
(string)
A target location.
Returns:
- true, etcd-client.client.jsstream instance
- false, etcd-client.error.http.HttpError.
- false, etcd-client.error.etcd.EtcdError.
- self
- instance.close (self)
-
Close a client pool.
Parameters:
- self
Pool instance.
Returns:
-
nil
- self
- instance.add (self, clients)
-
Add clients to the pool.
Parameters:
- self
Pool instance.
- clients
An array of clients. Each client must implement the pool instance interface: instance.request
Returns:
-
nil
- self
- instance.remove (self, clients)
-
Remove clients from the pool.
Parameters:
- self
Pool instance.
- clients
An array of clients.
Returns:
-
nil
Note that clients needs to be closed by the caller.
- self
- new (clients)
-
Create a new pool client instance.
Parameters:
- clients
(table)
An array of clients. Each client must implement the pool instance interface: instance.request
Returns:
-
a pool instance.
- clients
(table)