Module eetcd_lease

Behaviours: gen_server.

Function Index

close/0Close releases all resources Lease keeps for efficient communication with the etcd server.
code_change/3
grant/2Grant creates a new lease.
handle_call/3
handle_cast/2
handle_info/2
init/1
keep_alive/2KeepAlive attempts to keep the given lease alive forever.
keep_alive_once/2KeepAliveOnce renews the lease once.
leases/1Leases retrieves all leases.
new/1Create context for request.
revoke/2Revoke revokes the given lease.
start_link/3
terminate/2
test/0
time_to_live/3TimeToLive retrieves the lease information of the given lease ID.
with_timeout/2Timeout is an integer greater than zero which specifies how many milliseconds to wait for a reply, or the atom infinity to wait indefinitely.

Function Details

close/0

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/3

code_change(OldVsn, State, Extra) -> any()

grant/2

grant(Context::context(), TTL::pos_integer()) -> {ok, router_pb:'Etcd.LeaseGrantResponse'()} | {error, eetcd_error()}

Grant creates a new lease.

handle_call/3

handle_call(Request, From, State) -> any()

handle_cast/2

handle_cast(Request, State) -> any()

handle_info/2

handle_info(Info, State) -> any()

init/1

init(X1) -> any()

keep_alive/2

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.

KeepAlive makes best efforts to keep lease TTL, event the connection disconnect in 0 to ttl seconds. todo more detail

keep_alive_once/2

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/1

leases(ConnName::context()) -> {ok, router_pb:'Etcd.LeaseLeasesResponse'()} | {error, eetcd_error()}

Leases retrieves all leases.

new/1

new(Context::atom() | reference()) -> context()

Create context for request.

revoke/2

revoke(Context::context(), LeaseID::pos_integer()) -> {ok, router_pb:'Etcd.LeaseGrantResponse'()} | {error, eetcd_error()}

Revoke revokes the given lease.

start_link/3

start_link(Caller::pid(), Name::name(), LeaseID::integer()) -> {ok, pid()}

terminate/2

terminate(Reason, X2) -> any()

test/0

test() -> any()

time_to_live/3

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.

with_timeout/2

with_timeout(Context::context(), Timeout::pos_integer()) -> context()

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