#[non_exhaustive]pub struct NodeConfig {
pub policy: Option<Arc<dyn DynPolicy<EndpointId>>>,
pub decide_timeout: Duration,
pub table: Option<Producer>,
pub layout: Option<Arc<dyn Layout<EndpointId>>>,
}Expand description
The configuration of a Node.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.policy: Option<Arc<dyn DynPolicy<EndpointId>>>Decides who may hold a session with the node, and with which rights.
The node asks it when it accepts a session, after the peer’s MoQ
SETUP, and before it dials a peer. A rejection closes an accepted
session with the rejection’s code, and fails a dial with
Error::Rejected. Each session is decided on its own, with the
request and token it opened with, so a peer’s second session asks
the policy again.
The node asks again about a live session when its authorization
expires and on Node::reauthorize, with
Event::Reauthorize. An expired
session may do nothing until the new decision applies.
None is policy::Open with Grant::subscribe_only: every peer
may subscribe to anything and publish nothing.
decide_timeout: DurationHow long the node waits for each decision of its policy.
A decision that takes longer is a rejection with
moq_net::Error::Timeout. The default is DECIDE_TIMEOUT. Raise it
when a person answers, as with a policy::Queue.
When the node asks again about a live session, a timeout or a full
queue (moq_net::Error::TooManyRequests) is no rejection: the
session keeps its authorization, and the node asks again later.
table: Option<Producer>A route table to use instead of a new one, such as a media relay’s cluster origin.
The caller runs its driver. The node serves the table’s local view,
which hides routes from handles tagged Link::Peer
or Link::Upstream. None creates a table
under the hop derived from the endpoint id.
layout: Option<Arc<dyn Layout<EndpointId>>>The path layout that names the peer owning a path, for Node::claim_path.
None uses the generic rule: a path is a peer’s when exactly one of
its segments is the peer’s endpoint id.
Implementations§
Source§impl NodeConfig
impl NodeConfig
Sourcepub fn with_policy(self, policy: impl Policy<EndpointId>) -> Self
pub fn with_policy(self, policy: impl Policy<EndpointId>) -> Self
Returns this configuration with policy deciding who may hold a session.
Sourcepub fn with_decide_timeout(self, timeout: Duration) -> Self
pub fn with_decide_timeout(self, timeout: Duration) -> Self
Returns this configuration with timeout bounding each decision of the policy.
See decide_timeout.
Sourcepub fn with_table(self, table: Producer) -> Self
pub fn with_table(self, table: Producer) -> Self
Returns this configuration with table as the node’s route table.
See table.
Sourcepub fn with_layout(self, layout: impl Layout<EndpointId>) -> Self
pub fn with_layout(self, layout: impl Layout<EndpointId>) -> Self
Returns this configuration with layout naming the peer that owns a path.
See layout.