pub struct ViewerService {
pub pairing: Pairing,
pub hub: Arc<FeedHub>,
pub sends: Mutex<SendLedger>,
pub nonces: Mutex<NonceLog>,
/* private fields */
}Fields§
§pairing: Pairing§hub: Arc<FeedHub>§sends: Mutex<SendLedger>What each device sent lately: its rate limit and message_ids.
nonces: Mutex<NonceLog>The nonces of computers’ signed feed opens seen lately (signing::NonceLog).
Implementations§
Source§impl ViewerService
impl ViewerService
Sourcepub fn new(data_dir: Option<PathBuf>, broker: &Broker) -> Arc<Self> ⓘ
pub fn new(data_dir: Option<PathBuf>, broker: &Broker) -> Arc<Self> ⓘ
A viewer whose feeds watch broker.
pub fn with_limits( data_dir: Option<PathBuf>, broker: &Broker, hub: Arc<FeedHub>, max_per_device: usize, max_total: usize, ) -> Arc<Self> ⓘ
Sourcepub fn install_global(&self, broker: Arc<Broker>)
pub fn install_global(&self, broker: Arc<Broker>)
Make this the process’s viewer: its port is the advertised one (advertised_viewer_port), and a change of
who watches which agent is published on broker (ViewerWatchingChanged), for the window’s “being viewed”
strip and chip.
Sourcepub fn advertised_port_handle(&self) -> Arc<AtomicU16> ⓘ
pub fn advertised_port_handle(&self) -> Arc<AtomicU16> ⓘ
The handle the fleet feed reads viewer_port from.
pub fn advertised_port(&self) -> Option<u16>
Sourcepub fn tls(&self) -> Result<Arc<ViewerTls>, String>
pub fn tls(&self) -> Result<Arc<ViewerTls>, String>
The certificate, made and kept on first need.
Sourcepub fn reserve_port(
&self,
candidates: impl IntoIterator<Item = u16>,
) -> Option<u16>
pub fn reserve_port( &self, candidates: impl IntoIterator<Item = u16>, ) -> Option<u16>
The viewer port: the one already held, else the first port of
candidates free on loopback, now held. None when none is free.
Sourcepub fn set_bound(&self, addrs: Vec<IpAddr>, port: u16)
pub fn set_bound(&self, addrs: Vec<IpAddr>, port: u16)
Record which addresses viewer listeners are bound on, and advertise the port while there is at least one.
Sourcepub fn pair_host(&self) -> Option<IpAddr>
pub fn pair_host(&self) -> Option<IpAddr>
The IPv4 address the QR names: the primary outbound one when a viewer listener is bound there, else the first bound IPv4 address.
Sourcepub fn open_feed(
&self,
device_id: &str,
agent: Option<&str>,
) -> Result<FeedLease, FeedRefused>
pub fn open_feed( &self, device_id: &str, agent: Option<&str>, ) -> Result<FeedLease, FeedRefused>
Take a place for one more feed of device_id, or say why not. agent names the agent an agent’s feed
watches, so the host can show who watches it (Self::watching); a terminal’s or the system figures’ feed
has none.
Sourcepub fn close_device_feeds(&self, device_id: &str) -> usize
pub fn close_device_feeds(&self, device_id: &str) -> usize
Close every open feed of device_id (it was revoked, or the host’s person stopped its viewing). Returns
how many.
Sourcepub fn stop_viewing(&self, device_id: &str) -> usize
pub fn stop_viewing(&self, device_id: &str) -> usize
The host’s person stops device_id’s viewing: its open feeds end now and it opens none until
Self::allow_viewing (or srv restarts). Its pairing and grants stay. Returns how many feeds closed.
Sourcepub fn allow_viewing(&self, device_id: &str)
pub fn allow_viewing(&self, device_id: &str)
Let a device whose viewing was stopped open feeds again.
Sourcepub fn viewing_stopped(&self, device_id: &str) -> bool
pub fn viewing_stopped(&self, device_id: &str) -> bool
Whether the host’s person stopped device_id’s viewing.
Sourcepub fn set_watching_hook(&self, hook: WatchingHook)
pub fn set_watching_hook(&self, hook: WatchingHook)
Call hook whenever who watches which agent, or who sent one a message, changes.
Sourcepub fn note_sent(&self, device_id: &str, agent: &str, now_ms: i64)
pub fn note_sent(&self, device_id: &str, agent: &str, now_ms: i64)
Record that device_id sent agent a message at now_ms: it is driving the agent.
Sourcepub fn watching(&self) -> Vec<Watch>
pub fn watching(&self) -> Vec<Watch>
Who watches which agent now: one entry per device and agent, by device and then agent.
Sourcepub fn last_seen_due(&self, device_id: &str, now_ms: i64) -> bool
pub fn last_seen_due(&self, device_id: &str, now_ms: i64) -> bool
Whether device_id’s last_seen_ms is due to be written at now_ms;
records it when it is.
Sourcepub fn forget_device(&self, device_id: &str)
pub fn forget_device(&self, device_id: &str)
Forget a revoked device’s throttle entry and what it sent.
Auto Trait Implementations§
impl !Freeze for ViewerService
impl !RefUnwindSafe for ViewerService
impl !UnwindSafe for ViewerService
impl Send for ViewerService
impl Sync for ViewerService
impl Unpin for ViewerService
impl UnsafeUnpin for ViewerService
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> 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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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