Struct MockSource

Source
pub struct MockSource {
    pub queue: VecDeque<SourceMsg>,
    /* private fields */
}
Expand description

A mock source which should be used for testing purposes. This source mocks pushing & polling messages from a queue.

Fields§

§queue: VecDeque<SourceMsg>

Trait Implementations§

Source§

impl Default for MockSource

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Source for MockSource

Source§

fn name(&self) -> &'static str

return the name of this source
Source§

fn setup(&mut self) -> SourceResult<()>

Source setup logic should go here
Source§

fn ack(&mut self, _msg_id: MsgId) -> SourceResult<(i32, i32)>

Ack a single method with the upstream source
Source§

fn batch_ack(&mut self, msgs: Vec<MsgId>) -> SourceResult<(i32, i32)>

Batch ack a vector of messages with an upstream source
Source§

fn max_backoff(&self) -> SourceResult<&u64>

The configured maximum amount of time in milliseconds a source should backoff. This value is read by the TopologyActor when scheduling the next source.poll call
Source§

fn ack_policy(&self) -> SourceResult<&SourceAckPolicy>

Ack policy configuration
Source§

fn ack_interval(&self) -> SourceResult<&SourceInterval>

Configures how often the source should check for new messages to ack
Source§

fn poll_interval(&self) -> SourceResult<&SourceInterval>

Poll interval controls how often a Topology should ask for new messages
Source§

fn poll(&mut self) -> SourcePollResult

Poll for new message from the source
Source§

fn validate(&mut self) -> Result<(), SourceError>

Validation logic for determining if a source is properly configured at runtime.
Source§

fn shutdown(&mut self) -> Result<(), SourceError>

Source shutdown logic for closing connections, performing cleanup logic, etc.
Source§

fn connect(&mut self) -> Result<(), SourceError>

Source connection logic for creating client connections
Source§

fn healthy(&mut self) -> bool

Source health check. Should be used to determine if clients are still able to reach upstream brokers
Source§

fn monitor(&mut self) -> Result<(), SourceError>

Monitor is a special method which is the callback for the monitor interval It’s intended to ack as a special hook for keeping track of your source structure or performing other actions.
Source§

fn monitor_interval(&self) -> Result<&SourceInterval, SourceError>

Monitor interval controls how often the source monitor is called
Source§

fn flush_metrics(&mut self)

Sources can implement Metrics. This method is called by TopologyActor to internal source flush metrics to configured backend targets.

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.