Jido.Signal.Router.Engine (Jido Signal v2.2.2)

View Source

The routing engine that matches signals to handlers.

Summary

Functions

Builds the trie structure from validated routes.

Collects all routes from the trie into a list of Route structs.

Counts total routes in the trie.

Checks if handlers exist at the exact path in the trie.

Removes a path from the trie and returns the number of handlers removed.

Routes a signal through the trie to find matching handlers.

Functions

build_trie(routes, base_trie \\ %TrieNode{})

Builds the trie structure from validated routes.

collect_routes(trie)

Collects all routes from the trie into a list of Route structs.

count_routes(trie_node)

@spec count_routes(Jido.Signal.Router.TrieNode.t()) :: non_neg_integer()

Counts total routes in the trie.

has_path?(trie, segments)

@spec has_path?(Jido.Signal.Router.TrieNode.t(), [String.t()]) :: boolean()

Checks if handlers exist at the exact path in the trie.

remove_path(path, trie)

Removes a path from the trie and returns the number of handlers removed.

route_signal(trie, signal)

@spec route_signal(Jido.Signal.Router.TrieNode.t(), Jido.Signal.t()) :: [term()]

Routes a signal through the trie to find matching handlers.