pub struct Poller {
config: RwLock<PollerConfig>,
_handler: &'static ReactiveHandler,
running: Mutex<bool>,
poll_count: Mutex<u64>,
injections_count: Mutex<u64>,
last_poll: Mutex<Option<u64>>,
last_error: Mutex<Option<String>>,
}Expand description
Poller state for cross-host message polling from AgentMux.
Fields§
§config: RwLock<PollerConfig>§_handler: &'static ReactiveHandler§running: Mutex<bool>§poll_count: Mutex<u64>§injections_count: Mutex<u64>§last_poll: Mutex<Option<u64>>§last_error: Mutex<Option<String>>Implementations§
Source§impl Poller
impl Poller
Sourcepub fn new(config: PollerConfig, handler: &'static ReactiveHandler) -> Self
pub fn new(config: PollerConfig, handler: &'static ReactiveHandler) -> Self
Create a new poller with the given config.
Sourcepub fn is_configured(&self) -> bool
pub fn is_configured(&self) -> bool
Check if the poller is configured (has URL and token).
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Check if the poller is running.
Sourcepub fn status(&self) -> PollerStatus
pub fn status(&self) -> PollerStatus
Get poller status.
Sourcepub fn reconfigure(&self, url: Option<String>, token: Option<String>)
pub fn reconfigure(&self, url: Option<String>, token: Option<String>)
Reconfigure the poller with new URL and token.
Sourcepub fn record_poll(&self)
pub fn record_poll(&self)
Record a successful poll.
Sourcepub fn record_error(&self, err: &str)
pub fn record_error(&self, err: &str)
Record a poll error.
Sourcepub fn record_injections(&self, count: u64)
pub fn record_injections(&self, count: u64)
Record injections delivered.
Sourcepub fn set_running(&self, running: bool)
pub fn set_running(&self, running: bool)
Set the running state.
Auto Trait Implementations§
impl !Freeze for Poller
impl RefUnwindSafe for Poller
impl Send for Poller
impl Sync for Poller
impl Unpin for Poller
impl UnwindSafe for Poller
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
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.