retrace/wire
Versioned, application-neutral delivery envelopes. Payloads are application-encoded strings. This module checks transport and sequence invariants; it does not interpret the application’s model.
Types
pub type Batch {
Batch(
session: Session,
checkpoint: retrace.Checkpoint(String),
entries: List(retrace.Entry(Event)),
)
}
Constructors
-
Batch( session: Session, checkpoint: retrace.Checkpoint(String), entries: List(retrace.Entry(Event)), )
pub type Error {
MalformedEnvelope
InvalidSession
EmptyBatch
TooManyEntries
TooLarge
InvalidHistory(retrace.Error(Nil))
}
Constructors
-
MalformedEnvelope -
InvalidSession -
EmptyBatch -
TooManyEntries -
TooLarge -
InvalidHistory(retrace.Error(Nil))
pub type Event {
Event(kind: String, payload: String)
}
Constructors
-
Event(kind: String, payload: String)
What a writer states about a session before the server issues its id.
pub type Metadata {
Metadata(
user_ref: String,
build: String,
contract: String,
platform: String,
)
}
Constructors
-
Metadata( user_ref: String, build: String, contract: String, platform: String, )
pub type Session {
Session(
id: String,
user_ref: String,
build: String,
contract: String,
platform: String,
)
}
Constructors
-
Session( id: String, user_ref: String, build: String, contract: String, platform: String, )
Values
pub fn decode_grant(input: String) -> Result(Grant, Error)
Decode a grant and check that its id and token are well formed.
pub fn decode_upload(input: String) -> Result(Upload, Error)
Decode an upload. The batch is validated as decode_batch does, and a token
that is not a well-formed capability is malformed.
pub fn encode_grant(grant: Grant) -> String
pub fn encode_metadata(metadata: Metadata) -> String
pub fn encode_upload(upload: Upload) -> String
pub fn end_sequence(batch: Batch) -> Int
pub const max_entries: Int
pub const max_upload_bytes: Int
The largest encoded upload: a full batch plus its write token.
pub fn origin(session: Session) -> retrace.Origin
pub fn session_decoder() -> decode.Decoder(Session)