Mnemonix v0.10.0 Mnemonix.Stores.Elastix View Source
A Mnemonix.Store that uses Elastix to store state in ElasticSearch.
This store throws errors on the functions in Mnemonix.Features.Enumerable.
Link to this section Summary
Functions
Callback implementation for c:Mnemonix.Store.Behaviours.Map.delete/2
Callback implementation for c:Mnemonix.Store.Behaviours.Map.fetch/2
Callback implementation for c:Mnemonix.Store.Behaviours.Map.put/3
Connects to ElasticSearch to store data using provided opts
Starts a new store using the Mnemonix.Stores.Elastix module with options
Starts a new store using Mnemonix.Stores.Elastix with store and server options
Link to this section Functions
delete(Mnemonix.Store.t(), Mnemonix.key()) :: {:ok, Mnemonix.Store.t()} | Mnemonix.Store.Behaviour.exception()
Callback implementation for c:Mnemonix.Store.Behaviours.Map.delete/2.
fetch(Mnemonix.Store.t(), Mnemonix.key()) :: {:ok, Mnemonix.Store.t(), {:ok, Mnemonix.value()} | :error} | Mnemonix.Store.Behaviour.exception()
Callback implementation for c:Mnemonix.Store.Behaviours.Map.fetch/2.
put(Mnemonix.Store.t(), Mnemonix.key(), Mnemonix.Store.value()) :: {:ok, Mnemonix.Store.t()} | Mnemonix.Store.Behaviour.exception()
Callback implementation for c:Mnemonix.Store.Behaviours.Map.put/3.
setup(Mnemonix.Store.options()) ::
{:ok, state :: term()} |
{:stop, reason :: any()}
Connects to ElasticSearch to store data using provided opts.
Options
url:The url of the ElasticSearch instance to connect to.- Default:
"http://127.0.0.1:9200"
- Default:
index:The name of the index to store documents in.- Default:
:mnemonix
- Default:
type:The name of the type to store documents in.- Default:
:item
- Default:
refresh:Whether or not to force the ElasticSearch instance to reindex after every request.- Default:
true
- Default:
start_link(Mnemonix.Supervisor.options()) :: GenServer.on_start()
Starts a new store using the Mnemonix.Stores.Elastix module with options.
The options are the same as described in Mnemonix.Features.Supervision.start_link/2.
The :store options are used in config/1 to start the store;
the :server options are passed directly to GenServer.start_link/2.
The returned GenServer.server/0 reference can be used as the primary
argument to the Mnemonix API.
Examples
iex> {:ok, store} = Mnemonix.Stores.Elastix.start_link()
iex> Mnemonix.put(store, "foo", "bar")
iex> Mnemonix.get(store, "foo")
"bar"
iex> {:ok, _store} = Mnemonix.Stores.Elastix.start_link(server: [name: My.Mnemonix.Stores.Elastix])
iex> Mnemonix.put(My.Mnemonix.Stores.Elastix, "foo", "bar")
iex> Mnemonix.get(My.Mnemonix.Stores.Elastix, "foo")
"bar"
start_link(Mnemonix.Supervisor.options(), GenServer.options()) :: GenServer.on_start()
Starts a new store using Mnemonix.Stores.Elastix with store and server options.
The options are the same as described in Mnemonix.start_link/2.
The store options are used in config/1 to start the store;
the server options are passed directly to GenServer.start_link/2.
The returned GenServer.server/0 reference can be used as the primary
argument to the Mnemonix API.
Examples
iex> {:ok, store} = Mnemonix.Stores.Elastix.start_link([], [])
iex> Mnemonix.put(store, "foo", "bar")
iex> Mnemonix.get(store, "foo")
"bar"
iex> {:ok, _store} = Mnemonix.Stores.Elastix.start_link([], [name: My.Mnemonix.Stores.Elastix])
iex> Mnemonix.put(My.Mnemonix.Stores.Elastix, "foo", "bar")
iex> Mnemonix.get(My.Mnemonix.Stores.Elastix, "foo")
"bar"