pub struct ManagedBacktestSession { /* private fields */ }Expand description
High-level managed backtest session.
This wrapper owns the control manager, supported subscription managers,
cancellation, status gating, and shutdown order. Callers only need to react
to ManagedEvents and send ContinueParams after ReadyForContinue.
Implementations§
Source§impl ManagedBacktestSession
impl ManagedBacktestSession
Sourcepub async fn start(
url: String,
api_key: String,
create: CreateBacktestSessionRequest,
) -> Result<Self, ManagedSessionError>
pub async fn start( url: String, api_key: String, create: CreateBacktestSessionRequest, ) -> Result<Self, ManagedSessionError>
Start a managed session with an internally owned cancellation token.
Sourcepub async fn start_with_cancel(
url: String,
api_key: String,
create: CreateBacktestSessionRequest,
parent_cancel: CancellationToken,
) -> Result<Self, ManagedSessionError>
pub async fn start_with_cancel( url: String, api_key: String, create: CreateBacktestSessionRequest, parent_cancel: CancellationToken, ) -> Result<Self, ManagedSessionError>
Start a managed session tied to a caller-owned cancellation token.
Cancelling parent_cancel aborts startup and stops manager tasks.
Sourcepub fn session_info(&self) -> &SessionInfo
pub fn session_info(&self) -> &SessionInfo
Metadata reported by the server when the session was created.
Sourcepub fn subscribe_transactions(&mut self, program_ids: Vec<String>)
pub fn subscribe_transactions(&mut self, program_ids: Vec<String>)
Subscribe to transaction notifications for the configured programs.
Sourcepub fn subscribe_account_diffs(&mut self, program_ids: Vec<String>)
pub fn subscribe_account_diffs(&mut self, program_ids: Vec<String>)
Subscribe to account-diff notifications for the configured programs.
Sourcepub async fn next_event(&mut self) -> Result<ManagedEvent, ManagedSessionError>
pub async fn next_event(&mut self) -> Result<ManagedEvent, ManagedSessionError>
Receive the next control or subscription event.
On Completed, trailing subscription notifications are drained and
delivered before the Completed event.
Sourcepub async fn send_continue(
&mut self,
params: ContinueParams,
) -> Result<(), ManagedSessionError>
pub async fn send_continue( &mut self, params: ContinueParams, ) -> Result<(), ManagedSessionError>
Wait until the control connection and all subscription connections are
up, then send a Continue request.
Call this after receiving ManagedEvent::ReadyForContinue or
ManagedEvent::Paused. If there are no subscriptions, only the
control connection is gated.
Sourcepub async fn send_continue_to(
&mut self,
params: ContinueToParams,
) -> Result<(), ManagedSessionError>
pub async fn send_continue_to( &mut self, params: ContinueToParams, ) -> Result<(), ManagedSessionError>
Wait until the control connection and all subscription connections are
up, then send a ContinueTo request to step to a specific slot/batch
boundary.
Pair with ManagedEvent::DiscoveryBatch to drive a discovery-paced
loop: receive a discovery event, send ContinueTo(slot, batch_index),
and wait for ManagedEvent::Paused before inspecting state.
Trait Implementations§
Source§impl Drop for ManagedBacktestSession
impl Drop for ManagedBacktestSession
Auto Trait Implementations§
impl !RefUnwindSafe for ManagedBacktestSession
impl !UnwindSafe for ManagedBacktestSession
impl Freeze for ManagedBacktestSession
impl Send for ManagedBacktestSession
impl Sync for ManagedBacktestSession
impl Unpin for ManagedBacktestSession
impl UnsafeUnpin for ManagedBacktestSession
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more