Expand description
Reactive data layer between unifly-api and UI consumers (CLI / TUI).
This crate owns the business logic, domain model, and reactive data infrastructure for the UniFi CLI workspace:
-
Controller— Central facade managing the full lifecycle:connect()authenticates, fetches an initial data snapshot, then spawns background tasks for periodic refresh and command processing.Controller::oneshot()provides a lightweight fire-and-forget mode for single CLI invocations. -
DataStore— Lock-free reactive storage built onEntityCollection<T>(DashMap+tokio::sync::watchchannels). Merges Integration and Legacy API responses into canonical domain types. -
EntityStream<T>— Subscription handle vended by theDataStore. Exposescurrent()/latest()/changed()for TUI reactive rendering. -
Command— Typed mutation requests routed through anmpscchannel to the controller’s command processor. Reads bypass the channel via directDataStoresnapshots or ad-hoc API queries. -
Domain model (
model) — Canonical types (Device,Client,Network,FirewallPolicy,Event, etc.) withEntityIdsupporting both UUID (Integration API) and string-based (Legacy API) identifiers.
Re-exports§
pub use command::Command;pub use command::CommandResult;pub use config::AuthCredentials;pub use config::ControllerConfig;pub use config::TlsVerification;pub use controller::ConnectionState;pub use controller::Controller;pub use error::CoreError;pub use store::DataStore;pub use stream::EntityStream;pub use model::AclRule;pub use model::Admin;pub use model::Alarm;pub use model::Client;pub use model::ClientType;pub use model::Country;pub use model::Device;pub use model::DeviceState;pub use model::DeviceType;pub use model::DpiApplication;pub use model::DpiCategory;pub use model::EntityId;pub use model::Event;pub use model::EventCategory;pub use model::EventSeverity;pub use model::FirewallPolicy;pub use model::FirewallZone;pub use model::HealthSummary;pub use model::MacAddress;pub use model::Network;pub use model::RadiusProfile;pub use model::Site;pub use model::SysInfo;pub use model::SystemInfo;pub use model::TrafficMatchingList;pub use model::VpnServer;pub use model::VpnTunnel;pub use model::WanInterface;pub use command::requests::*;