MishkaCmsCore.Runtime.States.CompileFailureState (Mishka CMS Core v0.0.1)

Copy Markdown View Source

O(1) ETS record of runtime modules that failed to compile, keyed by module atom.

Lets the compile hot path short-circuit a known-broken module — failed?/1 is a pure :ets.member lookup, so a repeatedly-requested broken page is compiled once (and caught once) rather than recompiled-and-rescued on every request. A successful compile clears the entry; an :update recompile bypasses the cache and refreshes it.

{module, :offline} is an Error Page whose :offline entry compiled but raised when it was drawn; the module stays loaded for its other entries.

{MishkaCmsCore.Runtime.JsHook, hook_id, bundle} is a JS hook left out of a site's JavaScript bundle — see MishkaCmsCore.Runtime.Compilers.JavaScriptCompiler.left_out/1.

Read by MishkaCmsCore.Runtime.Handlers.ModuleCompilerHandler, MishkaCmsCore.Runtime.RuntimeStatus and MishkaCmsWeb.ErrorHTML.offline_page/1.

Summary

Functions

Returns a specification to start this module under a supervisor.

Forget a module's failure (e.g. after it compiles cleanly).

Forget every failure whose key matches pattern, an :ets match pattern.

Whether module is recorded as failed (fast hot-path check).

Every recorded {key, reason} whose key matches pattern, an :ets match pattern.

The recorded failure reason for module, or nil.

Record that module failed to compile, with its reason.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

clear(module)

Forget a module's failure (e.g. after it compiles cleanly).

clear_matching(pattern)

Forget every failure whose key matches pattern, an :ets match pattern.

failed?(module)

Whether module is recorded as failed (fast hot-path check).

matching(pattern)

Every recorded {key, reason} whose key matches pattern, an :ets match pattern.

reason(module)

The recorded failure reason for module, or nil.

record(module, reason)

Record that module failed to compile, with its reason.

start_link(opts \\ [])