Skip to main content

Module managed

Module managed 

Source
Expand description

Sessions that reconnect on their own.

Use ManagedBacktestSession for one session, or ManagedParallelSession for a run the server splits across concurrent sessions. Each one:

  • creates the session;
  • reconnects a dropped connection;
  • closes the session on shutdown.

§Parallel runs

ManagedParallelSession::start_with_params returns when every child is attached. If one child fails, it closes the attached children and returns the error.

§Connection drops

  • A dropped connection is retried with backoff, up to RECONNECT_MAX_ATTEMPTS attempts within RECONNECT_MAX_TOTAL. The session keeps running on the server meanwhile, unless disconnect_timeout_secs is 0.
  • The control channel reconnects. You see no gap in responses.
  • If the session has ended, the client stops with ManagedSessionError::ControlFailed.
  • A subscription reconnects from the last slot it delivered and sends that slot again: dedupe transactions by signature, and account diffs by (signature, account, slot).
  • When the budget runs out, the next continue fails: see the error table in the crate docs.

Re-exports§

pub use subscription::SubscriptionHandle;
pub use subscription::SubscriptionNotification;

Structs§

ManagedBacktestSession
A session that reconnects on its own.
ManagedParallelSession
A parallel run: one session for each part of the split range.
ParallelSubSession
One session of a parallel run, driven like a ManagedBacktestSession with a subset of its methods: subscribe_transactions, subscribe_account_diffs, subscribe_actions, next_event, send_continue, rpc and shutdown.
SessionInfo
What the server reported when it created the session.
StartSessionParams
Parameters shared by ManagedBacktestSession and ManagedParallelSession startup.
StartSessionParamsBuilder
Use builder syntax to set the inputs and finish with build().
SubscriptionDiagnostics
Subscription diagnostics counters, shared across every subscription manager a run spawns.
SubscriptionHandle
Handle to a running subscription manager task. Managed sessions keep these internally; you read their notifications through next_event.

Enums§

ConnectionFailure
Why a managed connection gave up.
ConnectionStatus
State of one managed connection: the session control channel or a subscription.
ControlEvent
An event from the session control channel. Responses to reattach and close never arrive here.
CreateError
Why start could not create a managed session; carried by ManagedSessionError::Create.
ManagedEvent
An event from a managed session, returned by next_event.
ManagedSessionError
Why a managed session call failed.
SubscriptionNotification
One notification from a managed subscription. ManagedEvent wraps each in the variant of the same name.

Constants§

DEFAULT_DISCONNECT_TIMEOUT_SECS
How long the server keeps a session alive with no client attached, when a single session’s create leaves disconnect_timeout_secs unset.
RECONNECT_MAX_ATTEMPTS
Attempt budget for retrying one connection. See RECONNECT_MAX_TOTAL.
RECONNECT_MAX_TOTAL
Time budget for retrying one connection. When it, or RECONNECT_MAX_ATTEMPTS, runs out, the connection becomes ConnectionStatus::Failed.