pub struct WatchManager { /* private fields */ }Expand description
Manages watch subscriptions for change polling.
Implementations§
Source§impl WatchManager
impl WatchManager
Sourcepub fn subscribe(
&self,
username: &str,
ids: Vec<String>,
graph_version: u64,
) -> Result<String, String>
pub fn subscribe( &self, username: &str, ids: Vec<String>, graph_version: u64, ) -> Result<String, String>
Subscribe to changes on a set of entity IDs.
Returns the watch ID, or an error if a growth cap would be exceeded.
Sourcepub fn poll(
&self,
watch_id: &str,
username: &str,
graph: &SharedGraph,
) -> Option<Vec<HDict>>
pub fn poll( &self, watch_id: &str, username: &str, graph: &SharedGraph, ) -> Option<Vec<HDict>>
Poll for changes since the last poll.
Returns the current state of watched entities that have changed,
or None if the watch ID is not found or the caller is not the owner.
Sourcepub fn unsubscribe(&self, watch_id: &str, username: &str) -> bool
pub fn unsubscribe(&self, watch_id: &str, username: &str) -> bool
Unsubscribe a watch by ID.
Returns true if the watch existed, was owned by username, and was removed.
Sourcepub fn add_ids(&self, watch_id: &str, username: &str, ids: Vec<String>) -> bool
pub fn add_ids(&self, watch_id: &str, username: &str, ids: Vec<String>) -> bool
Add entity IDs to an existing watch.
Returns true if the watch exists, is owned by username, and
the addition would not exceed the per-watch entity ID limit.
Sourcepub fn remove_ids(&self, watch_id: &str, username: &str, ids: &[String]) -> bool
pub fn remove_ids(&self, watch_id: &str, username: &str, ids: &[String]) -> bool
Remove specific entity IDs from an existing watch.
Returns true if the watch exists and is owned by username.
If all IDs are removed, the watch remains but with an empty entity set.