Sooth.Context (Sooth v0.2.1)
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(), statistics: Aja.Vector.t(Sooth.Statistic.t()) }
A Context of id/count/statistics
Functions
Link to this function
find_statistic(context, event)
@spec find_statistic(t(), non_neg_integer()) :: {t(), Sooth.Statistic.t(), non_neg_integer()}
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, statistics: vec([])}
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, statistics: vec([%Sooth.Statistic{event: 3, count: 1}])}