Skip to main content

Crate platform_core

Crate platform_core 

Source
Expand description

§platform-core (Rust port)

Rust port of mercury-composable’s platform-core — the event-driven foundation layer. Canonical behavior spec: the Java project (system/platform-core, v4.8.6) — see draft-design-specs/platform-core-port.md.

Increment 1 — configuration management: the resources/ folder convention, MultiLevelMap composite keys, ConfigReader with ${...} substitution, and the AppConfigReader base-config singleton.

Increment 2 — event-bus foundation: the immutable EventEnvelope, the ComposableFunction contract (+ TypedFunction/TypedAdapter), the Platform registry with per-route worker pools, and the PostOffice messaging client (send + RPC). Functions are addressed only by route name and never call each other directly.

Re-exports§

pub use app_starter::AppStarter;
pub use app_starter::AutoStart;
pub use app_starter::EntryPoint;
pub use envelope::EventEnvelope;
pub use event_stream::EventStreamWriter;
pub use function::AppError;
pub use function::ComposableFunction;
pub use function::TypedAdapter;
pub use function::TypedFunction;
pub use graph::MiniGraph;
pub use graph::SimpleConnection;
pub use graph::SimpleNode;
pub use graph::SimpleRelationship;
pub use platform::FunctionOptions;
pub use platform::Platform;
pub use post_office::PostOffice;
pub use util::app_config_reader::AppConfigReader;
pub use util::config_reader::ConfigError;
pub use util::config_reader::ConfigReader;
pub use util::managed_cache::CacheValue;
pub use util::managed_cache::ManagedCache;
pub use util::multi_level_map::ConfigValue;
pub use util::multi_level_map::MultiLevelMap;
pub use util::overrides;
pub use util::resources;
pub use util::w3c_trace;
pub use inventory;

Modules§

actuator
Actuator endpoints — Rust port of the Java ActuatorServices (org.platformlambda.core.services.ActuatorServices), registered by the lifecycle’s essential-services phase and exposed over REST automation via the default endpoints (/info, /info/routes, /env, /health, /livenessprobe).
app_starter
Rust port of the Java application lifecycle — AutoStart + AppStarter (org.platformlambda.core.system) and the EntryPoint contract (org.platformlambda.core.models.EntryPoint).
automation
REST automation — the HTTP protocol boundary (Rust port of the Java org.platformlambda.automation package, increment-6 core scope; see draft-design-specs/platform-core-port.md §5e).
envelope
Rust port of the Java EventEnvelope (org.platformlambda.core.models.EventEnvelope) — the immutable message container between composable functions.
event_stream
HTTP response streaming — the producer side of the multi-shot reply route (Java EventStreamWriter).
function
The composable-function contract — Rust port of the Java LambdaFunction / TypedLambdaFunction<I, O> (org.platformlambda.core.models).
graph
The minimalist in-memory property graph — Rust port of org.platformlambda.core.graph.MiniGraph (+ SimpleNode, SimpleConnection, SimpleRelationship): nodes with types and untyped properties, unidirectional connections carrying optional typed relations, alias/id/type/property lookups, neighbor traversal and BFS path discovery. Designed for a few hundred nodes held entirely in memory — deliberately never a database (the repo vision’s non-goal); the Active Knowledge Graph layer (layer 3) builds on it.
logging
Structured logging with the application log context — Rust port of the Java LogContextConfig + JsonLogger/CompactAppender design (org.platformlambda.core.logging).
platform
Rust port of the Java Platform registry + the manager-worker dispatch (org.platformlambda.core.system.Platform / ServiceQueue / WorkerHandler).
post_office
Rust port of the Java PostOffice (org.platformlambda.core.system.PostOffice) — the inter-function messaging client.
registry
Link-time registration inventory — the Rust analog of Java’s classpath annotation scanning (design D6’s ergonomic layer). The attribute macros (#[preload], #[before_application], #[main_application]) submit entries here at link time; AutoStart collects them at startup, exactly as Java’s AppStarter scans for its annotations.
serializer
Null-transport policy for the wire serializers — the Rust mirror of Java’s serializer.null.transport (Java SimpleMapper/Gson for JSON and MsgPack for the event bus, both reading the same config).
telemetry
Rust port of the Java Telemetry service (org.platformlambda.core.services.Telemetry) — the built-in distributed.tracing function, registered by the lifecycle’s essential-services phase (the Java EssentialServiceLoader).
trace
Distributed-trace context — Rust port of the Java TraceInfo + LogContext/LogContextManager design (org.platformlambda.core).
util
Utility layer of platform-core — configuration management first (draft-design-specs/platform-core-port.md, increment 1).

Macros§

auto_start_main
Generate the application main() — the Java AutoStart.main(args) one-liner. Expands in the application crate, so the app’s own resources/ folder (next to its Cargo.toml) joins the resource roots:

Attribute Macros§

before_application
The Java @BeforeApplication(sequence) analog: an EntryPoint that runs before functions are registered (validation/compilation work). Lower sequences run first (default 10; 0 is framework-reserved; a failing hook aborts startup).
event_interceptor
The Java @EventInterceptor analog as a first-class marker attribute: the function receives the raw envelope and replies manually; the worker ignores its returned envelope. Order-insensitive — write it above or below #[preload], or inline as #[preload(..., interceptor)].
main_application
The Java @MainApplication(sequence) analog: the application entry point (EntryPoint), run after preload. Lower sequences run first (default 10).
optional_service
The Java @OptionalService("condition") analog — a first-class attribute that makes a composable function (#[preload]), a websocket server function (#[websocket_service]), a #[before_application] or a #[main_application] conditional on application configuration: the item registers only when the condition holds at startup (Java Feature.isRequired semantics — comma-separated OR, !key negation, key=value / key / key= forms, case-insensitive).
preload
The Java @PreLoad(route, instances, envInstances) analog: registers a composable function at startup.
websocket_service
The Java @WebSocketService(value, namespace) analog: registers a websocket server endpoint declaratively. The annotated struct implements ComposableFunction and receives the session lifecycle events (type: open / string / bytes / close) on its per-connection {session}.in route; replies go to the tx_path given in the headers.
zero_tracing
The Java @ZeroTracing analog as a first-class marker attribute: suppresses the function’s own telemetry (no dataset, no span) while the trace context still flows through for continuity. Order-insensitive — Java does not require a stacking order and neither does this port: write it above or below #[preload], or inline as #[preload(..., zero_tracing)].