Skip to main content

Crate kardia

Crate kardia 

Source
Expand description

Facade crate re-exporting the kardia crates.

Re-exports§

pub use kardia_fs as fs;
pub use kardia_hmr as hmr;
pub use kardia_http as http;
pub use kardia_include as include;
pub use kardia_loader as loader;
pub use kardia_logger_console as logger_console;
pub use kardia_server as server;
pub use kardia_server_acl as server_acl;
pub use kardia_server_echo as server_echo;
pub use kardia_server_proxy as server_proxy;
pub use kardia_server_static as server_static;
pub use kardia_timer as timer;

Modules§

index
Positions within a dependency tuple (inferred, never written by hand).
prelude
The names most plugins need.

Macros§

json
Construct a serde_json::Value from a JSON literal.

Structs§

AggregateError
Several independent failures, e.g. of the listeners of a parallel event.
ConfigCommitted
A fiber’s configuration was replaced through update (write-back point).
Context
A cheap, clonable handle to a position in the runtime: a root, the fiber that owns effects created through it, and its derivation scope (isolation and interception overlays).
Disposal
The completion of a disposal. Disposal makes progress without being polled: the synchronous part has already run, and any asynchronous rest runs as a spawned task, so dropping a Disposal does not cancel it.
Disposer
The inverse of an effect. Runs at most once (it is consumed).
EffectHandle
A non-owning handle to an effect. Dropping it does not dispose the effect: its lifetime is governed by the fiber it was registered on.
EffectMeta
Introspection of an effect: its label and the effects it adopted.
EffectScope
The collector handed to an effect body.
Error
A cheaply clonable, type-erased error.
Failure
A failure notification delivered outside runtime locks.
Fiber
A handle to a fiber (one instantiation of a plugin).
FiberId
The paper’s fiber name; never reused within a root. 0 is the root.
IdTable
An insertion-ordered registry addressed by never-reused ids.
ImplId
Identity of one provider binding; never reused, so “replaced by an equal value” is observable.
Inject
Declared dependencies: ordered keys, each with optional interception metadata.
Injected
A plugin context whose typed accesses are checked against its declared dependencies D at compile time: get::<S>() only compiles if S is in D.
Interrupted
Returned by an iteration boundary whose effect (or fiber load) has been superseded. Propagating it with ? is not a failure: what was collected so far is disposed normally.
Issue
One validation problem, located by its path inside the configuration.
Key
Name of a coeffect (service), e.g. "database" or "foo.bar".
Logger
A named logger bound to the fiber it was created for.
Message
Overlay
Mutable isolation and interception tables of a derived context.
Panicked
PluginDef
A type-erased plugin definition, as stored in the registry.
PluginInserted
A fiber was created (internal/plugin on insertion).
PluginRemoved
A fiber was retired (internal/plugin on removal).
RealmId
A realm (the paper’s isolation symbol). Realms are generative: every call to RealmId::new yields a fresh one, shared only by explicit reuse.
Registry
Registry operations of a root.
Replaced
A fiber was moved to another plugin implementation by registry.replace.
ServiceChanged
A binding of key in realm appeared or disappeared. Delivered only to listeners whose context resolves key to the same realm.
StatusChanged
Svc
An accessed service together with the context that accessed it.
ValidationError
A rejected configuration (the analogue of Standard Schema issues).

Enums§

AccessError
FiberState
The paper’s θ.
KardiaError
Level
PathSegment
RecoveryAction
The host’s decision after observing a failed, fully cleaned-up instance.
RecoveryPolicy
Failure isolation is independent of this policy. The default never retries.
RuntimeKey
Identity of a plugin in the registry: the plugin type, or the identity of a closure-based definition.
Value
Represents any valid JSON value.

Traits§

Bailable
Listener results that can stop a bail / serial dispatch.
Deps
A tuple of service types declared and accessed together: type Inject = (Database, Cache) → ctx.deps::<(Database, Cache)>()?.
Event
A typed event. Listeners are registered per event type.
Exporter
A log sink. Registering one is an effect of the registering fiber.
Has
D contains S (at position I).
Plugin
A statically typed plugin (the paper’s component (d, p, e)).
Service
A service type bound to its coeffect key.

Functions§

catalog
A catalog with every built-in plugin, under its own name and the name of the corresponding JavaScript package.
decode
Deserializes a configuration value into T, reporting the failing path.
hyphenate
fooBar → foo-bar, Qux → qux, snake_case → snake-case.
merge_shallow
Merges JSON objects key by key, later values winning (like Object.assign).

Type Aliases§

Check
An availability predicate of a binding, given the consumer’s interception metadata for the key (declared inject metadata first).
ConfigHook
A configuration resolution hook: receives the source configuration and the next stage (ultimately the plugin’s own decoding).
ErasedConfig
A decoded, type-erased plugin configuration.
Result
Settle
Resolves when a fiber has no transition in flight, with its failure if any.

Attribute Macros§

plugin
#[derive(Service)] and #[plugin]; with this crate, pass crate = ::kardia. #[plugin(name = "...", provide = ["key"], crate = path)] on async fn f(ctx: Context | Injected<(A, ..)>, config: Arc<Config>) -> Result<()> (the config parameter is optional) generates the plugin type F.

Derive Macros§

Service
#[derive(Service)] and #[plugin]; with this crate, pass crate = ::kardia. #[derive(Service)], with #[service(name = "...", crate = path)].