hecate_plugin behaviour (hecate_sdk v0.6.2)

View Source

Plugin behaviour — the loading contract the daemon calls.

Every in-VM plugin implements this behaviour. The daemon uses it to: - Initialize the plugin with its configuration - Discover API routes to mount under /plugin/{name}/api/... - Set up the plugin's ReckonDB event store - Serve the plugin's frontend static assets - Read the plugin's manifest (version, capabilities, permissions)

Summary

Callbacks

flag_maps/0

-callback flag_maps() -> #{binary() => evoq_bit_flags:flag_map()}.

health/0

(optional)
-callback health() -> ok | degraded | {unhealthy, Reason :: binary()}.

init/1

-callback init(Config :: map()) -> {ok, State :: term()} | {error, Reason :: term()}.

manifest/0

-callback manifest() -> map().

routes/0

-callback routes() -> [{Path :: string(), Handler :: module(), Opts :: term()}].

static_dir/0

-callback static_dir() -> file:filename() | none.

store_config/0

-callback store_config() ->
                          #hecate_store_config{store_id :: atom(),
                                               dir_name :: string(),
                                               description :: string(),
                                               options :: map()} |
                          none.