fragmentation

Types

Who wrote the content. Who made the decision. Who holds the intent.

pub type Author {
  Author(self: String)
}

Constructors

  • Author(self: String)

Who ran the process. Who executed. Who was the mechanism.

pub type Committer {
  Committer(self: String)
}

Constructors

  • Committer(self: String)

A node in the possibility space.

pub type Fragment {
  Shard(ref: Ref, witnessed: Witnessed, data: String)
  Fragment(
    ref: Ref,
    witnessed: Witnessed,
    data: String,
    fragments: List(Fragment),
  )
}

Constructors

  • Shard(ref: Ref, witnessed: Witnessed, data: String)

    Terminal: self-addressed, witnessed, carries data, stops.

  • Fragment(
      ref: Ref,
      witnessed: Witnessed,
      data: String,
      fragments: List(Fragment),
    )

    Self-similar: self-addressed, witnessed, carries data, contains fragments.

The witness’s account of what happened.

pub type Message {
  Message(self: String)
}

Constructors

  • Message(self: String)

A reference: address + label.

pub type Ref {
  Ref(sha: Sha, label: String)
}

Constructors

  • Ref(sha: Sha, label: String)

Content-addressed hash.

pub type Sha {
  Sha(self: String)
}

Constructors

  • Sha(self: String)

When the observation happened. Opaque string: ISO 8601, epoch, logical clock.

pub type Timestamp {
  Timestamp(self: String)
}

Constructors

  • Timestamp(self: String)

Git commit metadata. Who was here when this happened.

pub type Witnessed {
  Witnessed(
    author: Author,
    committer: Committer,
    timestamp: Timestamp,
    message: Message,
  )
}

Constructors

Values

pub fn author(value: String) -> Author

Create an author value.

pub fn children(frag: Fragment) -> List(Fragment)

Get child fragments. Shards have none.

pub fn committer(value: String) -> Committer

Create a committer value.

pub fn data(frag: Fragment) -> String

Get the data from a fragment.

pub fn fragment(
  ref: Ref,
  witnessed: Witnessed,
  data: String,
  fragments: List(Fragment),
) -> Fragment

Create a fragment. Self-similar, contains other fragments.

pub fn hash(data: String) -> Sha

Raw SHA-256 hash of a string.

pub fn hash_fragment(frag: Fragment) -> String

Content-address a fragment: SHA-256 of its canonical serialization.

pub fn is_fragment(frag: Fragment) -> Bool

Check if a fragment is a fragment (non-terminal).

pub fn is_shard(frag: Fragment) -> Bool

Check if a fragment is a shard.

pub fn message(value: String) -> Message

Create a message value.

pub fn ref(s: Sha, label: String) -> Ref

Create a reference.

pub fn self_ref(frag: Fragment) -> Ref

Get the ref (self-address) of a fragment.

pub fn self_witnessed(frag: Fragment) -> Witnessed

Get the witness record of a fragment.

pub fn serialize(frag: Fragment) -> String

Deterministic canonical serialization of a fragment.

pub fn serialize_ref(r: Ref) -> String

Deterministic canonical serialization of a ref.

pub fn serialize_witnessed(m: Witnessed) -> String

Deterministic canonical serialization of a witness record.

pub fn sha(value: String) -> Sha

Create a SHA from a raw string.

pub fn shard(
  ref: Ref,
  witnessed: Witnessed,
  data: String,
) -> Fragment

Create a shard. Terminal fragment.

pub fn timestamp(value: String) -> Timestamp

Create a timestamp value.

pub fn witnessed(
  a: Author,
  c: Committer,
  ts: Timestamp,
  msg: Message,
) -> Witnessed

Create a witness record.

Search Document