EngineBuilder

Struct EngineBuilder 

Source
pub struct EngineBuilder { /* private fields */ }
Expand description

Constructs and wires a ForwarderEngine.

Implementations§

Source§

impl EngineBuilder

Source

pub fn new(config: EngineConfig) -> Self

Source

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().

Source

pub fn face<F: Face>(self, face: F) -> Self

Register a face to be added at startup.

Source

pub fn strategy<S: ErasedStrategy>(self, s: S) -> Self

Override the forwarding strategy (default: BestRouteStrategy).

Source

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.

Source

pub fn content_store(self, cs: Arc<dyn ErasedContentStore>) -> Self

Override the content store implementation (default: LruCs).

Source

pub fn admission_policy(self, policy: Arc<dyn CsAdmissionPolicy>) -> Self

Override the CS admission policy (default: DefaultAdmissionPolicy).

Source

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.

Source

pub fn security_profile(self, p: SecurityProfile) -> Self

Set the security profile (default: SecurityProfile::Default).

  • Default: auto-wires validator + cert fetcher from SecurityManager
  • AcceptSigned: verify signatures but skip chain walking
  • Disabled: no validation (benchmarking only)
  • Custom(v): use a caller-provided validator
Source

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);
    }
}
Source

pub fn validator(self, v: Arc<Validator>) -> Self

Convenience: set a custom validator directly.

Source

pub fn discovery<D: DiscoveryProtocol>(self, d: D) -> Self

Set the discovery protocol (default: NoDiscovery).

Use CompositeDiscovery to run multiple protocols simultaneously.

Source

pub fn discovery_arc(self, d: Arc<dyn DiscoveryProtocol>) -> Self

Set a pre-boxed discovery protocol.

Source

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.

Source

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.).

Source

pub async fn build(self) -> Result<(ForwarderEngine, ShutdownHandle)>

Build the engine, spawn all tasks, and return handles.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more