View Source Conion.Store.Bucket (conion v0.1.0)
A Bucket is a key/value store in a supervised GenServer.
Use Conion.Store.new_bucket/1
to start a bucket.
The Server will use Conion.Store.BucketSupervisor.start_child/1
to do so.
Summary
Functions
Return the bucket name of the bucket at pid
safely call the GenServer.callback return an error tuple if the bucket is not alive
safely cast the GenServer.callback return an error tuple if the bucket is not alive
Returns a specification to start this module under a supervisor.
Retrun true if the bucket is not stored permanently
removes all entries from the bucket
Return the entry at id from the bucket
Returns the state of a server. You can pass an atom or pid.
Overridable
{:ok, {new_id,etry}}, {:error, :bucket_not_exist}
Return all entry from the bucket
Persist a bucket
return the bucket's persistor
Overridable
{:ok, {id,etry}}, {:error, :bucket_not_exist | :id_not_found}
{:ok, {id,etry}}, {:error, :bucket_not_exist | :id_not_found}
Start the server with either
Functions
Return the bucket name of the bucket at pid
safely call the GenServer.callback return an error tuple if the bucket is not alive
safely cast the GenServer.callback return an error tuple if the bucket is not alive
Returns a specification to start this module under a supervisor.
See Supervisor
.
Retrun true if the bucket is not stored permanently
removes all entries from the bucket
Return the entry at id from the bucket
Returns the state of a server. You can pass an atom or pid.
Overridable:
Prepares, validates, formats the given state to be passed to init()
{:ok, {new_id,etry}}, {:error, :bucket_not_exist}
Return all entry from the bucket
Persist a bucket
return the bucket's persistor
Overridable:
Should return the args passed to start_link. For a named server it extracts
the :initial_state from the opts
. For unnamed processes it takes opts
as the initial state.
{:ok, {id,etry}}, {:error, :bucket_not_exist | :id_not_found}
{:ok, {id,etry}}, {:error, :bucket_not_exist | :id_not_found}
Start the server with either
MyServer.start_link(initial_state) ... start an unregistered server with the given
initial state.
MyServer.start_link(name: :registered_as_whatever, initial_state: any) ...
start a registered server with `initial_state` as it's state.