Skip to main content

EngineConfig

Struct EngineConfig 

Source
#[non_exhaustive]
pub struct EngineConfig { pub role: Role, pub version: Version, pub call_timeout: Duration, pub inbound_concurrency: InboundConcurrency, pub heartbeat: HeartbeatPolicy, pub retry: RetryPolicy, pub offline: OfflinePolicy, pub backoff: Backoff, pub enforce_boot_gate: bool, pub boot_retry_fallback: Duration, pub max_peer_requests: usize, pub inbound_rate: Option<RateLimit>, }
Expand description

Engine configuration.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§role: Role

Which side this is.

§version: Version

The negotiated protocol version.

§call_timeout: Duration

How long to wait for a CALLRESULT / CALLERROR.

The specification deliberately leaves this implementation-defined (Part 4 §4.1.1); 2.x sources it from NetworkConnectionProfile.messageTimeout, falling back to OCPPCommCtrlr.MessageTimeout[Default]. 30 s is the widely used default.

§inbound_concurrency: InboundConcurrency

What to do about a peer that keeps two calls in flight.

§heartbeat: HeartbeatPolicy

Whether the engine sends Heartbeat itself.

§retry: RetryPolicy

Retry schedule for transaction-related messages.

§offline: OfflinePolicy

Offline queueing behaviour.

§backoff: Backoff

Reconnect back-off parameters, for the driver to use (Part 4 §5.4).

§enforce_boot_gate: bool

Whether the boot state machine gates outgoing calls (B02.FR.02).

Always on for a Charging Station; a CSMS uses it to enforce B02.FR.09.

§boot_retry_fallback: Duration

How long to wait before re-sending BootNotification when the CSMS answered Pending or Rejected with interval = 0 (B02.FR.07).

§max_peer_requests: usize

Upper bound on the peer’s simultaneously unanswered CALLs.

The specification allows exactly one (Part 4 §4.1.1), and InboundConcurrency::Serve deliberately tolerates more — but “more” must still be finite, or a peer that never stops asking can make the receiver hold requests, and handler tasks, without limit. Beyond this many the extra call is answered ProtocolError regardless of InboundConcurrency.

§inbound_rate: Option<RateLimit>

How often the peer may send unprompted messages; None (the default) for no limit.

Counted: every CALL, SEND, malformed frame and answer to a call that is not outstanding. Never counted: answers to our own outstanding call, whose rate is ours. Over the rate, a CALL is answered SecurityError before any other check — it never becomes an Output::Request or an in-flight call — and everything else is dropped without an answer or a violation, because answering a flood is what it is for. Output::RateLimited reports the first refusal of each run.

Implementations§

Source§

impl EngineConfig

Source

pub fn new(role: Role, version: Version) -> Self

A configuration with the specification’s defaults.

Source

pub const fn with_call_timeout(self, timeout: Duration) -> Self

Sets the message timeout.

Source

pub const fn with_retry(self, retry: RetryPolicy) -> Self

Sets the transaction retry schedule.

Source

pub const fn with_offline(self, offline: OfflinePolicy) -> Self

Sets the offline queueing policy.

Source

pub const fn with_heartbeat(self, heartbeat: HeartbeatPolicy) -> Self

Sets the heartbeat policy.

Source

pub const fn with_inbound_rate(self, rate: RateLimit) -> Self

Limits how often the peer may send unprompted messages. See inbound_rate.

Source

pub const fn with_inbound_concurrency(self, mode: InboundConcurrency) -> Self

Sets what happens when the peer keeps two calls in flight.

Trait Implementations§

Source§

impl Clone for EngineConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EngineConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.