View Source Minikv.Registry (minikv v0.1.1)
A registry for Minikv, providing a distributed key-value store.
Summary
Functions
Returns a specification to start this module under a supervisor.
Deletes a value from the registry.
Retrieves a value from the registry.
Callback implementation for GenServer.init/1
.
Lock a key in the registry.
Persist a key value in the registry.
Puts a value into the registry.
Unlock a key in the registry.
Types
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Deletes a value from the registry.
Example
iex> {:ok, registry} = Minikv.Registry.start_link(name: :my_registry)
iex> Minikv.Registry.delete(registry, "my_key")
:ok
Retrieves a value from the registry.
Example
iex> {:ok, registry} = Minikv.Registry.start_link(name: :my_registry)
iex> Minikv.Registry.get(registry, "my_key")
%Minikv.Kv{value: "my_value", node: :node1, time: 123456789}
Callback implementation for GenServer.init/1
.
Lock a key in the registry.
Example
iex> {:ok, registry} = Minikv.Registry.start_link(name: :my_registry)
iex> Minikv.Registry.lock(registry, "my_key")
:ok
Persist a key value in the registry.
Example
iex> {:ok, registry} = Minikv.Registry.start_link(name: :my_registry)
iex> Minikv.Registry.delete(registry, "my_key")
:ok
Puts a value into the registry.
Example
iex> {:ok, registry} = Minikv.Registry.start_link(name: :my_registry)
iex> Minikv.Registry.put(registry, "my_key", "my_value")
:ok
Unlock a key in the registry.
Example
iex> {:ok, registry} = Minikv.Registry.start_link(name: :my_registry)
iex> Minikv.Registry.lock(registry, "my_key")
:ok
iex> Minikv.Registry.unlock(registry, "my_key")
:ok