Skip to main content

Crate alef_component_runtime

Crate alef_component_runtime 

Source
Expand description

Verified artifact installation and dynamic loading for Alef native components.

§Downloads

DownloadOptions tunes timeouts, retries (transient errors only), progress reporting and cancellation; pass it to ComponentManager::with_download_options or ArtifactCache::with_download_options. The defaults match the historical 10 s connect and 300 s total timeouts.

§Root certificates

Downloads trust the compiled-in Mozilla roots (RootCerts::WebPki). Behind a TLS-inspecting proxy, enable this crate’s platform-verifier feature and select RootCerts::PlatformVerifier with DownloadOptions::with_root_certs to use the operating system trust store. Requesting it without the feature fails the download with a clear error.

§Mirrors

A lock entry’s url is fixed when the lock is generated. Air-gapped and corporate hosts can redirect downloads at runtime with ComponentManager::with_url_override (any Fn(&ComponentLockEntry) -> String) or ComponentManager::with_mirror_base (serve every archive as {base}/{archive file name}). Integrity does not depend on the URL: the archive size and SHA-256 and the manifest signature are checked against the lock regardless of where the bytes came from, so a mirror cannot substitute content.

§Cache maintenance

ComponentManager::list_cached, ComponentManager::remove and ComponentManager::prune (with Retain) manage the shared on-disk cache. Loading an object touches a last-used stamp so several host versions can share one cache and prune by recency. Prune also sweeps crash leftovers (.install-* staging dirs, orphaned temp files and stale .lock files). Files Windows refuses to delete because a library is loaded are listed under RemovalReport::skipped.

§Verified stamp

ComponentManager::with_verified_stamp (off by default) skips re-hashing an installed library when a stamp recorded after a full check still matches the file’s size, mtime and, on Unix, device, inode and ctime. See ArtifactCache::with_verified_stamp for what this does and does not protect against.

Modules§

stdio
Framed stdio transport for bytes-only named component contracts.
target
Host target detection for native components.

Structs§

ArtifactCache
CachedArtifact
CachedObject
One installed object in the cache.
ComponentArtifactRecord
ComponentIdentity
ComponentInstance
A live instance created by a component, paired with its typed C function table.
ComponentLibrary
ComponentLock
ComponentLockEntry
ComponentManager
ComponentManifest
ComponentProvidedContract
One contract a component provides, alongside the Rust type implementing it.
ComponentRequirements
What a loaded component’s descriptor must match.
ComponentSignature
DownloadOptions
How a component archive is downloaded.
LoadedComponent
RemovalReport
What a removal or prune did.
Retain
Which objects ComponentManager::prune keeps. An object is kept when it satisfies any enabled criterion; with none enabled everything is removed.
Runtime
SkippedRemoval
A path a cleanup could not remove, and why.
VerifyingKey
An ed25519 public key.

Enums§

ComponentDeliveryMode
Whether a component is downloaded on demand or must be linked into the binding ahead of time. alef’s config-resolution code (alef::codegen::component) re-exports this type and exposes it on the resolved component config as a forward-looking hook; no loader or backend acts on Bundled yet.
ComponentError
ComponentStatus
Where a configured component currently stands, independent of its on-disk location (see ComponentManager::cache_path for that). Generated bindings expose this as both a stable string tag and a numeric code (alef_component_status/alef_component_status_code in alef::backends::native_components) so callers in any host language can branch on it without parsing free-form text.
RootCerts
Which trust anchors verify the TLS server certificate of a component download.
TrustPolicy

Constants§

COMPONENT_ABI_VERSION
COMPONENT_MANIFEST_SCHEMA

Traits§

HostServices
Services a host exposes to the components it loads.

Functions§

canonical_json
decode_public_key
Decode an Ed25519 public key from PEM, or from base64-encoded (standard or unpadded) raw 32-byte / DER SubjectPublicKeyInfo bytes.
take_owned_bytes⚠
Copy an owned buffer’s bytes into a Vec<u8> and release the original allocation through its own free callback.
take_owned_text⚠
Like take_owned_bytes, but lossily decodes the bytes as UTF-8.

Type Aliases§

ProgressCallback
Callback invoked as archive bytes stream in: (downloaded, total), where total is the archive size pinned by the lock entry.