Issho.Stream (Issho v0.4.0)

Copy Markdown View Source

A stream of a room, as it is now (Issho.Streams): what it is, whom it is for, who writes it, where it is, its state and what it holds so far.

  • :id: the stream's id, unique in the cluster.
  • :room: the room it is in.
  • :kind: what it is, in the app's or the component's words ("summary", "suggestion", "log"); Issho does not read it.
  • :for: who sees it: a key (a person's: theirs, and their agents'), :room (everyone who may read the room) or :policy (whomever the policy allows :read_stream).
  • :by: who writes it, an Issho.Identity, or nil.
  • :place: where it is, a place of a document of the room (Issho.Place), or nil.
  • :meta: the app's own, a map Issho keeps and sends.
  • :state: :writing, :finished, :failed or :closed.
  • :outcome: why it failed (:failed), or how it was closed (:closed): "accepted", "rejected", "stopped", the app's own.
  • :content: what was written so far, a binary.
  • :size: its bytes.
  • :started_at: when it began, a DateTime.
  • :pid: its process, which Issho.Streams.append/2 and the others write to.

Summary

Functions

The stream as JSON (string keys, the time in ISO 8601), for a model or a browser: who writes it is their public identity.

Types

t()

@type t() :: %Issho.Stream{
  by: Issho.Identity.t() | nil,
  content: binary(),
  for: String.t() | :room | :policy,
  id: String.t(),
  instance: atom(),
  kind: String.t() | nil,
  meta: map(),
  outcome: String.t() | nil,
  pid: pid(),
  place: map() | nil,
  room: String.t(),
  size: non_neg_integer(),
  started_at: DateTime.t(),
  state: :writing | :finished | :failed | :closed
}

Functions

to_map(stream)

@spec to_map(t()) :: map()

The stream as JSON (string keys, the time in ISO 8601), for a model or a browser: who writes it is their public identity.