fault_rate() = float()
fuse_context() = sync | async_dirty
fuse_options() = {fuse_strategy(), fuse_refresh()}
fuse_refresh() = {reset, pos_integer()}
fuse_strategy() = {standard, pos_integer(), pos_integer()} | {fault_injection, fault_rate(), pos_integer(), pos_integer()}
ask/2 | Queries the state of a fuse. |
circuit_disable/1 | Administratively disables a circuit. |
circuit_enable/1 | Administratively (re-)enables a fuse. |
install/2 | Adds a new fuse to the running system. |
melt/1 | Melts a fuse a little bit. |
remove/1 | Removes a fuse. |
reset/1 | Resets a fuse. |
run/3 | Runs a thunk under a given fuse. |
ask(Name, Context::fuse_context()) -> ok | blown | {error, not_found}
Queries the state of a fuse.
Given ask(N)
we ask the fuse state for the name N
. Returns the fuse state, either ok
or blown
.
If there is no such fuse, returns {error, not_found}
.
circuit_disable(Name) -> ok
Administratively disables a circuit.
This function is intended to be used administratively, when you want to break the fuse before you do administration on the service which the fuse protects. This can be used to e.g., carry out database maintenance. After maintenance, the administrator can reenable the circuit again.
Disabling a circuit dominates every other operation, except remove/1
.
circuit_enable(Name) -> ok
Administratively (re-)enables a fuse.
This call is used to reenable a disabled circuit again. Always returns ok and is idempotent.
Use this command at the point in time where you are done with administrative fixes and want to resume normal operation of the fuse.
install(Name, Options) -> ok | reset | {error, Reason}
Adds a new fuse to the running system.
A call install(N, Os)
will add a new fuse under the name N
with options given by Os
. Note that the options must match
the correct type, or a badarg
error will be thrown.
melt(Name) -> ok
Melts a fuse a little bit.
A call to melt(N)
will melt fuse N
. This call always returns ok
and it is currently implemented synchronously.
remove(Name) -> ok
Removes a fuse.
Given remove(N)
this removes the fuse under the name N
. This fuse will no longer exist.
reset(Name) -> ok | {error, not_found}
Resets a fuse.
Given reset(N)
this resets the fuse under the name N
. The fuse will be unbroken with no melts.
run(Name, Func::fun(() -> {ok, Result} | {melt, Result}), Context::fuse_context()) -> {ok, Result} | blown | {error, not_found}
Runs a thunk under a given fuse.
Calling run(Name, Func)
will run Func
protected by the fuse Name
.
Generated by EDoc