strata_protocol/operation
Opt-in mutation correlation. Request IDs identify submissions, not a server-side deduplication cache or a crash-durable receipt.
Mutation
Section titled “Mutation”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)}Outcome
Section titled “Outcome”The authority decision, distinct from persistence.
pub type Outcome { AcceptedInMemory Rejected(code: String, message: String) Unknown(message: String)}Unknown(message: String)
Section titled “Unknown(message: String)”The queued operation may still complete.
Receipt
Section titled “Receipt”A correlated server response.
pub type Receipt { Receipt(request_id: String, document_id: String, outcome: Outcome)}Request
Section titled “Request”A validated correlation ID and the immutable payload to resend.
pub type RequestRequestError
Section titled “RequestError”Request IDs must contain 1 to 128 UTF-8 bytes.
pub type RequestError { InvalidRequestId}Functions
Section titled “Functions”decode_receipt
Section titled “decode_receipt”Decode a correlated response independently of legacy server events.
pub fn decode_receipt(String) -> Result(Receipt, error.DecodeError)decode_request
Section titled “decode_request”Decode a correlated mutation, retaining both its ID and payload.
pub fn decode_request(String) -> Result(Request, error.DecodeError)document_id
Section titled “document_id”Return the document on which the request operates (the parent for create/delete).
pub fn document_id(Request) -> Stringencode
Section titled “encode”Encode a request using the existing v0 mutation shape plus request_id.
pub fn encode(Request) -> json.Jsonencode_receipt
Section titled “encode_receipt”Encode an opt-in outcome. No persisted or exactly-once outcome is offered.
pub fn encode_receipt(Receipt) -> json.JsonReturn the stable correlation ID.
pub fn id(Request) -> Stringrequest
Section titled “request”Construct a request. Generate an ID unique within the caller's session.
pub fn request( String, Mutation) -> Result(Request, RequestError)request_id
Section titled “request_id”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)retryable
Section titled “retryable”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