pub struct EngineBuilder { /* private fields */ }Expand description
Constructs and wires a ForwarderEngine.
Implementations§
Source§impl EngineBuilder
impl EngineBuilder
pub fn new(config: EngineConfig) -> Self
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 strategy<S: ErasedStrategy>(self, s: S) -> Self
pub fn strategy<S: ErasedStrategy>(self, s: S) -> Self
Override the forwarding strategy (default: BestRouteStrategy).
Sourcepub fn security(self, mgr: SecurityManager) -> Self
pub fn security(self, mgr: SecurityManager) -> Self
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>) -> Self
pub fn content_store(self, cs: Arc<dyn ErasedContentStore>) -> Self
Override the content store implementation (default: LruCs).
Sourcepub fn admission_policy(self, policy: Arc<dyn CsAdmissionPolicy>) -> Self
pub fn admission_policy(self, policy: Arc<dyn CsAdmissionPolicy>) -> Self
Override the CS admission policy (default: DefaultAdmissionPolicy).
Sourcepub fn cs_observer(self, obs: Arc<dyn CsObserver>) -> Self
pub fn cs_observer(self, obs: Arc<dyn CsObserver>) -> Self
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) -> Self
pub fn security_profile(self, p: SecurityProfile) -> Self
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) -> Self
pub fn schema_rule(self, rule: SchemaRule) -> Self
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>) -> Self
pub fn validator(self, v: Arc<Validator>) -> Self
Convenience: set a custom validator directly.
Sourcepub fn discovery<D: DiscoveryProtocol>(self, d: D) -> Self
pub fn discovery<D: DiscoveryProtocol>(self, d: D) -> Self
Set the discovery protocol (default: NoDiscovery).
Use CompositeDiscovery to run multiple protocols simultaneously.
Sourcepub fn discovery_arc(self, d: Arc<dyn DiscoveryProtocol>) -> Self
pub fn discovery_arc(self, d: Arc<dyn DiscoveryProtocol>) -> Self
Set a pre-boxed discovery protocol.
Sourcepub fn routing_protocol<P: RoutingProtocol>(self, proto: P) -> Self
pub fn routing_protocol<P: RoutingProtocol>(self, proto: P) -> Self
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>) -> Self
pub fn context_enricher(self, e: Arc<dyn ContextEnricher>) -> Self
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)>
pub async fn build(self) -> Result<(ForwarderEngine, ShutdownHandle)>
Build the engine, spawn all tasks, and return handles.