Markov.ModelServer (markov v2.4.1)
GenServer in charge of one model
Terminology:
- The master is the file that persists a server's state (incl. repartitioning data, options, etc.)
- A partition is a
dets
table that holds a preconfigured number of chain links. - Repartitioning occurs when, as a result of a training operation, the estimated average number of links in one partition has exceeded the preconfigured amount, so a new partition is created and data from the old ones is reshuffled between all new available partitions.
Assuming this Markov.load/3
call:
Markov.load("/basepath", "model_name")
This is the model structure on disk:
basepath
model_name
master.etf.gz
- the master in gzipped Erlang's External Term Formatoperation_log.csetf
- the operation log in Concatenated Sized External Term Format. Each log entry is encoded in ETF, preceded with its 16-bit size in bytes and appended to the log.part_0.dets
- partition number 0, a DETS tablepart_n.dets
- partition number n
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Callback implementation for GenServer.handle_continue/2
.
Callback implementation for GenServer.init/1
.
Link to this section Types
Link to this type
start_options()
@type start_options() :: [ name: String.t(), path: String.t(), create_opts: [Markov.model_option()] ]
Link to this section Functions
Link to this function
child_spec(init_arg)
Returns a specification to start this module under a supervisor.
See Supervisor
.
Link to this function
handle_continue(arg, state)
@spec handle_continue( {:repart, non_neg_integer() | :cleanup}, Markov.ModelServer.State.t() ) :: {:noreply, Markov.ModelServer.State.t(), {:continue, {:repart, non_neg_integer()}}} | {:noreply, Markov.ModelServer.State.t()}
Callback implementation for GenServer.handle_continue/2
.
Link to this function
init(options)
@spec init(options :: start_options()) :: {:ok, Markov.ModelServer.State.t()} | {:stop, term()}
Callback implementation for GenServer.init/1
.
Link to this function
open_partition!(state, num)
@spec open_partition!(state :: Markov.ModelServer.State.t(), num :: integer()) :: Markov.ModelServer.State.t()
Link to this function
start(options)
@spec start(options :: start_options()) :: DynamicSupervisor.on_start_child()
Link to this function
start_link(options)
@spec start_link(options :: start_options()) :: GenServer.on_start()