pub struct DatabentoFeedHandler { /* private fields */ }Expand description
Handles a raw TCP data feed from the Databento LSG for a single dataset.
LiveCommand messages are received synchronously across a channel,
decoded records are sent asynchronously on a tokio channel as LiveMessages
back to a message processing task.
§Crash Policy
This handler intentionally crashes on catastrophic feed issues rather than attempting recovery. If excessive buffering occurs (indicating severe feed misbehavior), the process will run out of memory and terminate. This is by design - such scenarios indicate fundamental problems that require external intervention.
Implementations§
Source§impl DatabentoFeedHandler
impl DatabentoFeedHandler
Sourcepub fn new(
key: String,
dataset: String,
rx: UnboundedReceiver<LiveCommand>,
tx: Sender<LiveMessage>,
publisher_venue_map: IndexMap<PublisherId, Venue>,
symbol_venue_map: Arc<RwLock<AHashMap<Symbol, Venue>>>,
use_exchange_as_venue: bool,
bars_timestamp_on_close: bool,
reconnect_timeout_mins: Option<u64>,
) -> Self
pub fn new( key: String, dataset: String, rx: UnboundedReceiver<LiveCommand>, tx: Sender<LiveMessage>, publisher_venue_map: IndexMap<PublisherId, Venue>, symbol_venue_map: Arc<RwLock<AHashMap<Symbol, Venue>>>, use_exchange_as_venue: bool, bars_timestamp_on_close: bool, reconnect_timeout_mins: Option<u64>, ) -> Self
Creates a new DatabentoFeedHandler instance.
§Panics
Panics if exponential backoff creation fails (should never happen with valid hardcoded parameters).
Sourcepub async fn run(&mut self) -> Result<()>
pub async fn run(&mut self) -> Result<()>
Runs the feed handler main loop, processing commands and streaming market data.
Establishes a connection to the Databento LSG, subscribes to requested data feeds, and continuously processes incoming market data messages until shutdown.
Implements automatic reconnection with exponential backoff (1s to 60s with jitter).
Each successful session resets the reconnection cycle, giving the next disconnect
a fresh timeout window. Gives up after reconnect_timeout_mins if configured.
§Errors
Returns an error if any client operation or message handling fails.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DatabentoFeedHandler
impl RefUnwindSafe for DatabentoFeedHandler
impl Send for DatabentoFeedHandler
impl Sync for DatabentoFeedHandler
impl Unpin for DatabentoFeedHandler
impl UnwindSafe for DatabentoFeedHandler
Blanket Implementations§
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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