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

strata_client/operation

Bounded session-local tracking for opt-in correlated mutations. Hosts retain the session across socket reconnects, and explicitly retry safe operations. This module does not persist requests after browser loss.

Explicit request tracking and retry errors.

pub type Error {
DuplicateRequestId
RequestLimitReached
UnknownRequestId
UnsafeCreateRetry
AlreadyCompleted
StillAmbiguous
WrongReceiptDocument
ProtocolError(error.DecodeError)
ConnectionError(strata_client.StepError)
}

A normal connection event or a correlated operation receipt.

pub type Event {
ConnectionEvent(strata_client.Event)
OperationOutcome(operation.Receipt)
}

A bounded tracker. Terminal records remain until forget.

pub type Session

Session-local operation status.

pub type Status {
Pending
Observed(operation.Outcome)
}

Send a normal client command, such as Join or Leave, through this session.

pub fn command(
Session,
strata_client.Command
) -> #(Session, String)

Return the connection state for presence and join inspection.

pub fn connection(Session) -> strata_client.Connection

Release a terminal record. Never reuse its ID within this logical session.

pub fn forget(
Session,
String
) -> Result(Session, Error)

Receive a correlated receipt or a legacy document/connection event.

pub fn inbound(
Session,
String
) -> Result(#(Session, Event), Error)

Create a session around a normal client connection.

pub fn new(strata_client.Connection) -> Session

Mark in-flight operations unknown and emit only resume joins. The host must call retry explicitly; reconnect never silently retries a create.

pub fn resume(Session) -> #(Session, List(String))

Retry the exact delta/delete bytes with the original request ID.

pub fn retry(
Session,
String
) -> Result(#(Session, String), Error)

Inspect a tracked operation, including an ambiguous timeout.

pub fn status(
Session,
String
) -> Result(Status, Error)

Track and encode a new immutable request. At most 1024 records are retained.

pub fn submit(
Session,
operation.Request
) -> Result(#(Session, String), Error)

Mark a local response deadline as unknown, without turning it into rejection.

pub fn timed_out(
Session,
String
) -> Result(Session, Error)