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

strata_protocol/operation

Opt-in mutation correlation. Request IDs identify submissions, not a server-side deduplication cache or a crash-durable receipt.

A mutation for which the caller requests an outcome.

pub type Mutation {
Delta(document_id: String, state: json.Json)
Create(parent: String, child: String, child_state: json.Json, parent_state: json.Json)
Delete(parent: String, child: String, parent_state: json.Json)
}

The authority decision, distinct from persistence.

pub type Outcome {
AcceptedInMemory
Rejected(code: String, message: String)
Unknown(message: String)
}

The queued operation may still complete.

A correlated server response.

pub type Receipt {
Receipt(request_id: String, document_id: String, outcome: Outcome)
}

A validated correlation ID and the immutable payload to resend.

pub type Request

Request IDs must contain 1 to 128 UTF-8 bytes.

pub type RequestError {
InvalidRequestId
}

Decode a correlated response independently of legacy server events.

pub fn decode_receipt(String) -> Result(Receipt, error.DecodeError)

Decode a correlated mutation, retaining both its ID and payload.

pub fn decode_request(String) -> Result(Request, error.DecodeError)

Return the document on which the request operates (the parent for create/delete).

pub fn document_id(Request) -> String

Encode a request using the existing v0 mutation shape plus request_id.

pub fn encode(Request) -> json.Json

Encode an opt-in outcome. No persisted or exactly-once outcome is offered.

pub fn encode_receipt(Receipt) -> json.Json

Return the stable correlation ID.

pub fn id(Request) -> String

Construct a request. Generate an ID unique within the caller's session.

pub fn request(
String,
Mutation
) -> Result(Request, RequestError)

Read optional correlation from a decoded frame. Invalid IDs are errors, not legacy requests without correlation.

pub fn request_id(dynamic.Dynamic) -> Result(option.Option(String), RequestError)

State merges and same-parent deletes can be retried. Create cannot be inferred successful from ChildExists, so hosts must reconcile it explicitly.

pub fn retryable(Request) -> Bool