Behaviours: gen_server.
close/0 | Close releases all resources Lease keeps for efficient communication with the etcd server. |
code_change/3 | |
grant/2 | Grant creates a new lease with the provided TTL in seconds. |
handle_call/3 | |
handle_cast/2 | |
handle_info/2 | |
init/1 | |
keep_alive/2 | KeepAlive attempts to keep the given lease alive forever. |
keep_alive_once/2 | KeepAliveOnce renews the lease once. |
leases/1 | Leases retrieves all leases. |
new/1 | Create context for request. |
revoke/2 | Revoke revokes the given lease. |
start_link/3 | |
terminate/2 | |
time_to_live/3 | TimeToLive retrieves the lease information of the given lease ID. |
with_timeout/2 | Timeout is an integer greater than zero which specifies how many milliseconds to wait for a reply, or the atom infinity to wait indefinitely. |
close() -> pos_integer()
Close releases all resources Lease keeps for efficient communication with the etcd server.
Return the count of all close processes.
If you want to revokes the given lease, please use revoke/2
.
code_change(OldVsn, State, Extra) -> any()
grant(Context::context(), TTL::pos_integer()) -> {ok, router_pb:'Etcd.LeaseGrantResponse'()} | {error, eetcd_error()}
Grant creates a new lease with the provided TTL in seconds.
handle_call(Request, From, State) -> any()
handle_cast(Request, State) -> any()
handle_info(Info, State) -> any()
init(X1) -> any()
keep_alive(Name::name(), LeaseID::pos_integer()) -> {ok, pid()} | {error, term()}
KeepAlive attempts to keep the given lease alive forever.
If client keep alive processes halts with an unexpected error (e.g. "etcdserver: no leader") or canceled by others,
KeepAlive process send a KeepAliveHalted event(#{event =>
KeepAliveHalted', lease_id => ID, reason => Reason}') to caller.
keep_alive_once(Name::name(), LeaseID::pos_integer()) -> {ok, router_pb:'Etcd.LeaseKeepAliveResponse'()} | {error, eetcd_error()}
KeepAliveOnce renews the lease once. The response corresponds to the first message from calling KeepAlive. If the response has a recoverable error, KeepAliveOnce will not retry the RPC with a new keep alive message. In most of the cases, Keepalive should be used instead of KeepAliveOnce.
leases(ConnName::context()) -> {ok, router_pb:'Etcd.LeaseLeasesResponse'()} | {error, eetcd_error()}
Leases retrieves all leases.
new(Context::atom() | reference()) -> context()
Create context for request.
revoke(Context::context(), LeaseID::pos_integer()) -> {ok, router_pb:'Etcd.LeaseGrantResponse'()} | {error, eetcd_error()}
Revoke revokes the given lease.
start_link(Caller::pid(), Name::name(), LeaseID::integer()) -> {ok, pid()}
terminate(Reason, X2) -> any()
time_to_live(Context::context(), LeaseID::pos_integer(), WithKeys::boolean()) -> {ok, router_pb:'Etcd.LeaseGrantResponse'()} | {error, eetcd_error()}
TimeToLive retrieves the lease information of the given lease ID.
The 3rd argument is a option of NeedAttachedKeys
.
Timeout is an integer greater than zero which specifies how many milliseconds to wait for a reply,
or the atom infinity to wait indefinitely. Default value is 5000.
If no reply is received within the specified time, the function call fails with {error, timeout}
.
Generated by EDoc