pub struct GrokListener { /* private fields */ }Expand description
Push listener for every live local grok session.
Implementations§
Source§impl GrokListener
impl GrokListener
Sourcepub fn new(
homeserver_url: impl Into<String>,
store_root: impl Into<PathBuf>,
leader_sock: impl Into<PathBuf>,
) -> Self
pub fn new( homeserver_url: impl Into<String>, store_root: impl Into<PathBuf>, leader_sock: impl Into<PathBuf>, ) -> Self
Does not register and does not open a socket.
Sourcepub fn hear_providers(&mut self, sessions: Vec<ProviderSession>)
pub fn hear_providers(&mut self, sessions: Vec<ProviderSession>)
Replaces the set of live non-Grok sessions (from
crate::provider::registry::live_sessions). Grok rows are
ignored here: they come from active_sessions.json and keep ACP.
The next Self::tick adopts new ones and stops driving gone ones.
Sourcepub fn listen_for_sends(&mut self, path: &Path) -> Result<(), ShellError>
pub fn listen_for_sends(&mut self, path: &Path) -> Result<(), ShellError>
Bind the local send socket. A live peer already bound there is an error. A stale address file is replaced.
Sourcepub fn tick(
&mut self,
heard: &[Heard],
now_ms: i64,
full_drive_secs: u64,
) -> ListenReport
pub fn tick( &mut self, heard: &[Heard], now_ms: i64, full_drive_secs: u64, ) -> ListenReport
Register any heard session that is not open yet, then drain the
push socket and drive the sessions that are still in heard.
Driving is what presses ACP. A session that left the index is not
driven, so a dead process is not prompted.
Sourcepub fn send_to(
&mut self,
session_id: &str,
to_nick: &str,
text: &str,
now_ms: i64,
wait: Duration,
) -> Result<(String, Option<String>), ShellError>
pub fn send_to( &mut self, session_id: &str, to_nick: &str, text: &str, now_ms: i64, wait: Duration, ) -> Result<(String, Option<String>), ShellError>
Encrypted DM from an already opened session. The store looks the
nick up on the server, reuses or opens a direct room, and
OpenedStore::write_to_nick sends only after that peer has joined.
Drive performs the key query and the ciphertext send. This does not
open a public room.