Skip to main content

DataStore

Struct DataStore 

Source
pub struct DataStore { /* private fields */ }
Expand description

Central reactive store for all UniFi domain entities.

Thread-safe and lock-free: all reads are wait-free, writes use fine-grained per-shard locks within DashMap. Mutations are broadcast to subscribers via watch channels.

Implementations§

Source§

impl DataStore

Source

pub fn new() -> Self

Source

pub fn devices_snapshot(&self) -> Arc<Vec<Arc<Device>>>

Source

pub fn clients_snapshot(&self) -> Arc<Vec<Arc<Client>>>

Source

pub fn networks_snapshot(&self) -> Arc<Vec<Arc<Network>>>

Source

pub fn wifi_broadcasts_snapshot(&self) -> Arc<Vec<Arc<WifiBroadcast>>>

Source

pub fn firewall_policies_snapshot(&self) -> Arc<Vec<Arc<FirewallPolicy>>>

Source

pub fn firewall_zones_snapshot(&self) -> Arc<Vec<Arc<FirewallZone>>>

Source

pub fn acl_rules_snapshot(&self) -> Arc<Vec<Arc<AclRule>>>

Source

pub fn dns_policies_snapshot(&self) -> Arc<Vec<Arc<DnsPolicy>>>

Source

pub fn vouchers_snapshot(&self) -> Arc<Vec<Arc<Voucher>>>

Source

pub fn sites_snapshot(&self) -> Arc<Vec<Arc<Site>>>

Source

pub fn events_snapshot(&self) -> Arc<Vec<Arc<Event>>>

Source

pub fn traffic_matching_lists_snapshot( &self, ) -> Arc<Vec<Arc<TrafficMatchingList>>>

Source

pub fn device_by_mac(&self, mac: &MacAddress) -> Option<Arc<Device>>

Source

pub fn device_by_id(&self, id: &EntityId) -> Option<Arc<Device>>

Source

pub fn client_by_mac(&self, mac: &MacAddress) -> Option<Arc<Client>>

Source

pub fn client_by_id(&self, id: &EntityId) -> Option<Arc<Client>>

Source

pub fn network_by_id(&self, id: &EntityId) -> Option<Arc<Network>>

Source

pub fn device_count(&self) -> usize

Source

pub fn client_count(&self) -> usize

Source

pub fn network_count(&self) -> usize

Source

pub fn subscribe_devices(&self) -> EntityStream<Device>

Source

pub fn subscribe_clients(&self) -> EntityStream<Client>

Source

pub fn subscribe_networks(&self) -> EntityStream<Network>

Source

pub fn subscribe_wifi_broadcasts(&self) -> EntityStream<WifiBroadcast>

Source

pub fn subscribe_firewall_policies(&self) -> EntityStream<FirewallPolicy>

Source

pub fn subscribe_firewall_zones(&self) -> EntityStream<FirewallZone>

Source

pub fn subscribe_acl_rules(&self) -> EntityStream<AclRule>

Source

pub fn subscribe_dns_policies(&self) -> EntityStream<DnsPolicy>

Source

pub fn subscribe_vouchers(&self) -> EntityStream<Voucher>

Source

pub fn subscribe_sites(&self) -> EntityStream<Site>

Source

pub fn subscribe_events(&self) -> EntityStream<Event>

Source

pub fn subscribe_traffic_matching_lists( &self, ) -> EntityStream<TrafficMatchingList>

Source

pub fn site_health_snapshot(&self) -> Arc<Vec<HealthSummary>>

Source

pub fn subscribe_site_health(&self) -> Receiver<Arc<Vec<HealthSummary>>>

Source

pub fn last_full_refresh(&self) -> Option<DateTime<Utc>>

Source

pub fn last_ws_event(&self) -> Option<DateTime<Utc>>

Source

pub fn data_age(&self) -> Option<Duration>

How long ago the last full refresh occurred, or None if never refreshed.

Trait Implementations§

Source§

impl Default for DataStore

Source§

fn default() -> Self

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

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more