Skip to content
Strata is pre-1.0. APIs, protocol, and storage format may change.

strata_server/doc_presence

Tracks live socket counts per document for read-only admin status.

Opaque handle to the document presence tracker actor.

pub type Tracker

Build a supervised tracker with a stable handle and empty restart state.

pub fn child_spec() -> #(Tracker, supervision.ChildSpecification(Nil))

Return live socket counts by document id.

Returns Error(ActorCallTimedOut) if the tracker actor does not reply before the configured timeout.

pub fn counts(Tracker) -> Result(List(#(String, Int)), store.ActorCallError)

Record a socket joining a document.

pub fn join(
Tracker,
String,
String
) -> Nil

Record a socket leaving a document.

pub fn leave(
Tracker,
String,
String
) -> Nil

Start an empty document presence tracker.

pub fn start() -> Result(Tracker, actor.StartError)