pub struct Platform { /* private fields */ }Expand description
The service registry: route name → manager + worker pool. Cheap to clone.
Implementations§
Source§impl Platform
impl Platform
pub fn new() -> Self
Sourcepub fn get_instance() -> Platform
pub fn get_instance() -> Platform
The process-wide platform (Java Platform.getInstance()), created on
first use. Platform::new() remains available for isolated registries
(tests); the lifecycle (AppStarter) uses this shared one.
Sourcepub fn name() -> String
pub fn name() -> String
The application name (Java platform.getName()): application.name,
else application — Java’s primary key and default. The Java
spring.application.name fallback is retired with the other Spring
names (maintainer decision, 2026-07-19; Spring is not ported).
Sourcepub fn origin() -> &'static str
pub fn origin() -> &'static str
This process’s unique origin id (Java platform.getOrigin(),
simplified: a uuid per process; Java’s optional appId derivation is not
ported until something needs it).
Sourcepub fn register(
&self,
route: &str,
function: Arc<dyn ComposableFunction>,
instances: usize,
) -> Result<(), AppError>
pub fn register( &self, route: &str, function: Arc<dyn ComposableFunction>, instances: usize, ) -> Result<(), AppError>
Register a function at a route with instances concurrent workers
(Java platform.register(route, lambda, instances)).
Sourcepub fn register_private(
&self,
route: &str,
function: Arc<dyn ComposableFunction>,
instances: usize,
) -> Result<(), AppError>
pub fn register_private( &self, route: &str, function: Arc<dyn ComposableFunction>, instances: usize, ) -> Result<(), AppError>
Register a PRIVATE function (Java platform.registerPrivate): callable
only inside this application instance — Event over HTTP rejects it
with 403. Engine internals register this way (increment 60).
Sourcepub fn is_private(&self, route: &str) -> Option<bool>
pub fn is_private(&self, route: &str) -> Option<bool>
Whether a registered route is private (Java ServiceDef.isPrivateFunction);
None when the route is not registered.
Sourcepub fn register_with_options(
&self,
route: &str,
function: Arc<dyn ComposableFunction>,
instances: usize,
options: FunctionOptions,
) -> Result<(), AppError>
pub fn register_with_options( &self, route: &str, function: Arc<dyn ComposableFunction>, instances: usize, options: FunctionOptions, ) -> Result<(), AppError>
Register with explicit options (increment E-3 extends the increment-10 zero-trace flag with the event-interceptor mode).
Sourcepub fn has_route(&self, route: &str) -> bool
pub fn has_route(&self, route: &str) -> bool
True when the route is registered locally (Java hasRoute).
Sourcepub fn release(&self, route: &str) -> bool
pub fn release(&self, route: &str) -> bool
Release a route (Java release): signals the manager to stop; workers
exit as their channels close; the elastic queue is destroyed. Returns
whether the route existed.
Sourcepub fn register_route_pool(
&self,
prefix: &str,
function: Arc<dyn ComposableFunction>,
count: usize,
) -> Result<Vec<String>, AppError>
pub fn register_route_pool( &self, prefix: &str, function: Arc<dyn ComposableFunction>, count: usize, ) -> Result<Vec<String>, AppError>
Register a route pool — a set of private singleton routes
{prefix}.{n} for n = 0 to count-1 (Java Platform.registerRoutePool).
Each member runs with one worker, so it is a strict FIFO lane; a caller
may check out a lane for exclusive use to preserve event order while
other lanes serve concurrent traffic. One function instance is shared
across all members — it must be stateless, the same contract as a
multi-instance function.
Registering an existing pool RELOADS it: the previous member set is released first, with a warning in the application log. This API covers registration only — lane checkout and return are the caller’s concern. Route pools are always private.
Sourcepub fn release_route_pool(&self, prefix: &str) -> bool
pub fn release_route_pool(&self, prefix: &str) -> bool
Release a route pool — removes all its members and the pool itself
(Java Platform.releaseRoutePool). Returns whether the pool existed.