pub struct EngineBuilder { /* private fields */ }Expand description
Re-export the engine builder for convenience.
Constructs and wires a ForwarderEngine.
Implementations§
Source§impl EngineBuilder
impl EngineBuilder
pub fn new(config: EngineConfig) -> EngineBuilder
Sourcepub fn alloc_face_id(&self) -> FaceId
pub fn alloc_face_id(&self) -> FaceId
Pre-allocate a FaceId from the engine’s face table.
This allows callers to know the ID that will be assigned to a face
before calling build(), so the ID can be passed to discovery
protocols or other components at construction time. The actual face
object should be added via builder.face(…) or
engine.add_face_with_persistency(…) after build().
Sourcepub fn face<F>(self, face: F) -> EngineBuilderwhere
F: Face,
pub fn face<F>(self, face: F) -> EngineBuilderwhere
F: Face,
Register a face to be added at startup.
Sourcepub fn strategy<S>(self, s: S) -> EngineBuilderwhere
S: ErasedStrategy,
pub fn strategy<S>(self, s: S) -> EngineBuilderwhere
S: ErasedStrategy,
Override the forwarding strategy (default: BestRouteStrategy).
Sourcepub fn security(self, mgr: SecurityManager) -> EngineBuilder
pub fn security(self, mgr: SecurityManager) -> EngineBuilder
Set the security manager for signing and verification.
When set, the engine exposes the manager via ForwarderEngine::security()
so pipeline stages and the management layer can access it.
Sourcepub fn content_store(self, cs: Arc<dyn ErasedContentStore>) -> EngineBuilder
pub fn content_store(self, cs: Arc<dyn ErasedContentStore>) -> EngineBuilder
Override the content store implementation (default: LruCs).
Sourcepub fn admission_policy(
self,
policy: Arc<dyn CsAdmissionPolicy>,
) -> EngineBuilder
pub fn admission_policy( self, policy: Arc<dyn CsAdmissionPolicy>, ) -> EngineBuilder
Override the CS admission policy (default: DefaultAdmissionPolicy).
Sourcepub fn cs_observer(self, obs: Arc<dyn CsObserver>) -> EngineBuilder
pub fn cs_observer(self, obs: Arc<dyn CsObserver>) -> EngineBuilder
Register a CS observer for hit/miss/insert/eviction events.
When set, the CS is wrapped in ObservableCs which adds atomic
counters and calls the observer on every operation.
Sourcepub fn security_profile(self, p: SecurityProfile) -> EngineBuilder
pub fn security_profile(self, p: SecurityProfile) -> EngineBuilder
Set the security profile (default: SecurityProfile::Default).
Default: auto-wires validator + cert fetcher from SecurityManagerAcceptSigned: verify signatures but skip chain walkingDisabled: no validation (benchmarking only)Custom(v): use a caller-provided validator
Sourcepub fn schema_rule(self, rule: SchemaRule) -> EngineBuilder
pub fn schema_rule(self, rule: SchemaRule) -> EngineBuilder
Add a static trust schema rule loaded at startup.
Rules are added to the validator’s schema after the profile’s default rules are applied. Call this once per rule, or apply many rules by iterating over a config list:
for rule in &config.security.rules {
if let Ok(r) = SchemaRule::parse(&format!("{} => {}", rule.data, rule.key)) {
builder = builder.schema_rule(r);
}
}Sourcepub fn validator(self, v: Arc<Validator>) -> EngineBuilder
pub fn validator(self, v: Arc<Validator>) -> EngineBuilder
Convenience: set a custom validator directly.
Sourcepub fn discovery<D>(self, d: D) -> EngineBuilderwhere
D: DiscoveryProtocol,
pub fn discovery<D>(self, d: D) -> EngineBuilderwhere
D: DiscoveryProtocol,
Set the discovery protocol (default: NoDiscovery).
Use CompositeDiscovery to run multiple protocols simultaneously.
Sourcepub fn discovery_arc(self, d: Arc<dyn DiscoveryProtocol>) -> EngineBuilder
pub fn discovery_arc(self, d: Arc<dyn DiscoveryProtocol>) -> EngineBuilder
Set a pre-boxed discovery protocol.
Sourcepub fn routing_protocol<P>(self, proto: P) -> EngineBuilderwhere
P: RoutingProtocol,
pub fn routing_protocol<P>(self, proto: P) -> EngineBuilderwhere
P: RoutingProtocol,
Register a routing protocol to start when the engine is built.
Multiple protocols can be registered; each must use a distinct origin
value. They run as independent Tokio tasks and all write routes into the
shared RIB. Use ForwarderEngine::routing after build() to enable
or disable protocols dynamically at runtime.
Sourcepub fn context_enricher(self, e: Arc<dyn ContextEnricher>) -> EngineBuilder
pub fn context_enricher(self, e: Arc<dyn ContextEnricher>) -> EngineBuilder
Register a cross-layer context enricher.
Enrichers are called before every strategy invocation to populate
StrategyContext::extensions with data from external sources
(radio metrics, flow stats, location, etc.).
Sourcepub async fn build(self) -> Result<(ForwarderEngine, ShutdownHandle), Error>
pub async fn build(self) -> Result<(ForwarderEngine, ShutdownHandle), Error>
Build the engine, spawn all tasks, and return handles.