Sooth.Context (Sooth v0.3.2)
Provides the Context module for Sooth.
This module is mainly used for internal implementation details of the Sooth.Predictor module and should not be used directly.
Summary
Types
@type t() :: %Sooth.Context{ count: non_neg_integer(), id: non_neg_integer(), statistic_objects: map(), statistic_set: :gb_sets.set() }
A Context of id/count/statistics
Functions
Link to this function
find_statistic(context, event)
@spec find_statistic(t(), non_neg_integer()) :: Sooth.Statistic.t() | nil
Find a statistic in a context.
This is an implementation detail and should not be used directly.
Link to this function
new(id)
@spec new(non_neg_integer()) :: t()
Create a new context.
Examples
iex> Sooth.Context.new(0)
#Sooth.Context<id: 0, count: 0, statistic_set: [], statistic_objects: %{}>
Link to this function
observe(context, event)
@spec observe(t(), non_neg_integer()) :: {t(), Sooth.Statistic.t()}
Observe an event in a context.
Examples
iex> context = Sooth.Context.new(0)
iex> {context, _} = Sooth.Context.observe(context, 3)
iex> context
#Sooth.Context<id: 0, count: 1, statistic_set: [3], statistic_objects: %{3 => %Sooth.Statistic{count: 1, event: 3}}>
Link to this function