fun_with_flags_in_memory v0.1.1 FunWithFlags.Store.Persistent.InMemory View Source
An in-memory persistence layer for FunWithFlags, to be used in :test mode
Link to this section Summary
Functions
Retrieves all the names of the persisted flags.
Retrieves all the persisted flags.
Deletes an entire flag, identified by name.
Deletes a gate from a flag, identified by name.
Retrieves a flag by name.
Persists a gate for a flag, identified by name.
A persistent adapter should return either
a child specification
if it needs any process to be started and supervised, or nil
if it does not.
Link to this section Functions
all_flag_names() View Source
Retrieves all the names of the persisted flags.
Callback implementation for FunWithFlags.Store.Persistent.all_flag_names/0
.
all_flags() View Source
Retrieves all the persisted flags.
Callback implementation for FunWithFlags.Store.Persistent.all_flags/0
.
child_spec(opts \\ []) View Source
delete(flag_name) View Source
Deletes an entire flag, identified by name.
Callback implementation for FunWithFlags.Store.Persistent.delete/1
.
delete(flag_name, gate) View Source
Deletes a gate from a flag, identified by name.
Callback implementation for FunWithFlags.Store.Persistent.delete/2
.
get(flag_name) View Source
Retrieves a flag by name.
Callback implementation for FunWithFlags.Store.Persistent.get/1
.
handle_call(arg1, from, gates) View Source
init(_) View Source
put(flag_name, gate) View Source
Persists a gate for a flag, identified by name.
Callback implementation for FunWithFlags.Store.Persistent.put/2
.
start_link(opts \\ []) View Source
to_atom(atm) View Source
worker_spec() View Source
A persistent adapter should return either
a child specification
if it needs any process to be started and supervised, or nil
if it does not.
For example, the builtin Redis persistence adapter implements this function by delegating to
Redix.child_spec/1
because it needs the Redix processes to work. On the other hand, the
builtin Ecto adapter implements this function by returning nil
, because the Ecto repo is
provided to this package by the host application, and it's assumed that the Ecto process tree
is started and supervised somewhere else.
This custom worker_spec/0
function is used instead of the typical child_spec/1
function
because this function can return nil
if the adapter doesn't need to be supervised, whereas
child_spec/1
must return a valid child spec map.
Callback implementation for FunWithFlags.Store.Persistent.worker_spec/0
.