Meeseeks v0.11.0 Meeseeks.Context View Source
Context is available to both Meeseek's selection process and each individual selector, and allows for selectors to build state (or receive state from the selection mechanism).
The selection process expects an accumulator
, return?
boolean, and
matches
map to exist in the context, and stores selected nodes in the
accumulator
, stores matching nodes than need to be filtered in the
matches
map, and halts selection if the return?
boolean becomes true.
Link to this section Summary
Functions
Returns the key under which the accumulator is stored in the context
Adds an accumulator to context, overriding any existing accumulator in context
Updates the context's accumulator with the result of calling Accumulator.add on the current accumulator with the provided document and id, and sets return? to the result of calling Accumulator.complete? on the updated accumulator if return? was not already true
Adds a node to a list in the context's matches map corresponding to the selector that the node matched
Clears the context's matches map
Ensures that context contains an accumulator, returning context if it does, or raising an error if it does not
Returns the key under which matching nodes that need to be filtered are stored in the context
Returns the key under which the nodes currently being walked are stored in the context
Adds keys required by selection process to the context
Returns the result of calling Accumulator.return on the context's accumulator
Returns the key under which return? is stored in the context
Link to this section Types
Link to this section Functions
accumulator_key()
View Source
accumulator_key() :: atom()
accumulator_key() :: atom()
Returns the key under which the accumulator is stored in the context.
add_accumulator(context, acc)
View Source
add_accumulator(t(), Meeseeks.Accumulator.t()) :: t()
add_accumulator(t(), Meeseeks.Accumulator.t()) :: t()
Adds an accumulator to context, overriding any existing accumulator in context.
add_to_accumulator(context, document, id)
View Source
add_to_accumulator(t(), Meeseeks.Document.t(), Meeseeks.Document.node_id()) ::
t()
add_to_accumulator(t(), Meeseeks.Document.t(), Meeseeks.Document.node_id()) :: t()
Updates the context's accumulator with the result of calling Accumulator.add on the current accumulator with the provided document and id, and sets return? to the result of calling Accumulator.complete? on the updated accumulator if return? was not already true.
add_to_matches(context, selector, node)
View Source
add_to_matches(t(), Meeseeks.Selector.t(), Meeseeks.Document.node_t()) ::
t()
add_to_matches(t(), Meeseeks.Selector.t(), Meeseeks.Document.node_t()) :: t()
Adds a node to a list in the context's matches map corresponding to the selector that the node matched.
clear_matches(context) View Source
Clears the context's matches map.
ensure_accumulator!(context) View Source
Ensures that context contains an accumulator, returning context if it does, or raising an error if it does not.
matches_key()
View Source
matches_key() :: atom()
matches_key() :: atom()
Returns the key under which matching nodes that need to be filtered are stored in the context.
nodes_key()
View Source
nodes_key() :: atom()
nodes_key() :: atom()
Returns the key under which the nodes currently being walked are stored in the context.
prepare_for_selection(context) View Source
Adds keys required by selection process to the context.
Used internally by Meeseeks.Select- users should have no reason to call.
return_accumulator(map) View Source
Returns the result of calling Accumulator.return on the context's accumulator.
return_key()
View Source
return_key() :: atom()
return_key() :: atom()
Returns the key under which return? is stored in the context.