View Source Vectoree.TreeProcessor behaviour (Vectoree v0.0.2)

A behaviour module for implementing a server, which maintains a local tree (key-value map) as its internal state and reacts on changes on another part of the (global) tree. A processor is supposed to be

  • mounted on a TreeServer at a path via the TreeServer.mount_source/1 function, normally during the c:init/1 callback.
  • registered on one or more paths on a TreeServer via the TreeServer.register_sink/1 function, at any time.

It is then supposed to do three things:

  • Reply to query requests by returning the local tree in a mounted state (done by the handle_query functions in this module)
  • Notify the hosting TreeServer about updates in the local tree via the TreeServer.notify/2 function
  • React to notifications (casts) received from the hosting TreeServer via the handle_notify functions

Summary

Types

@type tree_map() :: %{required(tree_path()) => any()}
@type tree_path() :: Vectoree.TreePath.t()

Callbacks

Link to this callback

handle_notify(tree_path, tree_map, tree_path, tree_map)

View Source (optional)
@callback handle_notify(tree_path(), tree_map(), tree_path(), tree_map()) :: tree_map()