Terrasol.Document (Terrasol v1.0.2) View Source

Handling of the Earthstar document format and the resulting Terrasol.Document.t structures

Link to this section Summary

Types

t()

An Earthstar document

Functions

Build a Terrasol.Document from a map containing all or some of the required keys.

Parse and return a Terrasol.Document from a map.

Link to this section Types

Specs

t() :: %Terrasol.Document{
  author: Terrasol.Author.t(),
  content: String.t(),
  contentHash: String.t(),
  deleteAfter: nil | pos_integer(),
  format: String.t(),
  path: Terrasol.Path.t(),
  signature: String.t(),
  timestamp: pos_integer(),
  workspace: Terrasol.Workspace.t()
}

An Earthstar document

Link to this section Functions

Build a Terrasol.Document from a map containing all or some of the required keys.

This is resolved internally in a deterministic way which is implementation-specific and should not be depended upon to remain the same between versions.

A :ttl key may be used. It will be parsed into a :deleteAfter using the document timestamp and adding Terrasol.duration_us(ttl)

The final value is passed through parse/1 returning as that function does.

Parse and return a Terrasol.Document from a map.

Returns {:invalid, [error_field]} on an invalid document

A string document is presumed to be JSON