Lavash.Dsl.Graph (Lavash v0.4.0-rc.1)

Copy Markdown View Source

Builds and caches a Lavash.Rx.Graph from DSL module metadata.

This is the bridge between Spark DSL modules and the standalone Lavash.Reactive engine. It reads persisted field specs and state declarations, compiles them into a %Rx.Graph{}, and caches the result in persistent_term.

Summary

Functions

Returns a cached %Rx.Graph{} for the given DSL module.

Drops the cached graph for the given module.

Returns field names that depend on reads/forms of a given resource. Used for resource-centric invalidation when a child component mutates a resource.

Functions

compiled_graph(module)

Returns a cached %Rx.Graph{} for the given DSL module.

erase(env, bytecode)

Drops the cached graph for the given module.

Takes an Macro.Env and the module's bytecode so it matches the @after_compile callback shape. Lavash modules wire this in via build_cache_invalidation_ast/0 in their compile transformers so a hot recompile in dev replaces the cached graph instead of leaving the stale one in place.

fields_for_resource(module, resource)

Returns field names that depend on reads/forms of a given resource. Used for resource-centric invalidation when a child component mutates a resource.