View Source Baobab (Baobab v0.13.1)

Baobab is a pure Elixir implementation of the Bamboo append-only log.

It is fairly opinionated about the DETS persistence of the logs. They are considered to be a spool of the logs as retreived.

Consumers of this library may wish to place a local copy of the logs in a store with better indexing and query properties.

configuration

Configuration

config :baobab, spool_dir: "/tmp"

options

Options

  • format: :entry or :binary, default: :entry
  • log_id: the author's log identifier, default 0
  • clump_id: the bamboo clump with which associated, default: "default"
  • revalidate: confirm the store contents are unchanged, default: false
  • replace: rewrite log contents even if it exists, default: false

Link to this section Summary

Functions

A list of all {author, log_id, seqnum} tuples in the configured store

Retrieve the list of sequence numbers on a particular log identified by the author key and log number

Create and store a new log entry for a stored identity

Resolve an identity to its Base62 representation

Retrieve a list of all populated clumps

Compact log contents to only items in the certificate pool for the latest entry. This allows validation while reducing space used

Create and store a new identity string

Retrieve the current hash of the :content or :identity store.

Drop a stored identity. Baobab will be unable to recover keys (notably :secret keys) destroyed herewith.

Retrieve all available entries in a particular log

List all known identities with their base62 public key representation

Retrieve the key for a stored identity.

Retrieve an author log at a particular sequence number. Includes the available certificate pool for its verification.

Retreive a paticular entry by author and sequence number.

Retrieve all available author log entries over a specified range: {first, last}.

Retrieve the latest sequence number on a particular log identified by the author key and log number

Purges a given log.

Rename an extant identity leaving its keys intact.

A list of {author, log_id, max_seqnum} tuples in the configured store

Link to this section Functions

Link to this function

all_entries(clump_id \\ "default")

View Source

A list of all {author, log_id, seqnum} tuples in the configured store

Link to this function

all_seqnum(author, options \\ [])

View Source

Retrieve the list of sequence numbers on a particular log identified by the author key and log number

Link to this function

append_log(payload, identity, options \\ [])

View Source

Create and store a new log entry for a stored identity

Resolve an identity to its Base62 representation

Attempts to resolve ~short using stored logs

Retrieve a list of all populated clumps

Link to this function

compact(author, options \\ [])

View Source

Compact log contents to only items in the certificate pool for the latest entry. This allows validation while reducing space used

Link to this function

create_identity(identity, secret_key \\ nil)

View Source
@spec create_identity(String.t(), binary() | nil) :: String.t() | {:error, String.t()}

Create and store a new identity string

An optional secret key to be associated with the identity may provided, either raw or base62 encoded. The public key will be derived therefrom.

Link to this function

current_hash(which, clump_id \\ "default")

View Source

Retrieve the current hash of the :content or :identity store.

No information should be gleaned from any particular hash beyond whether the contents have changed since a previous check.

@spec drop_identity(String.t()) :: :ok | {:error, String.t()}

Drop a stored identity. Baobab will be unable to recover keys (notably :secret keys) destroyed herewith.

Link to this function

full_log(author, options \\ [])

View Source

Retrieve all available entries in a particular log

@spec identities() :: [{String.t(), String.t()}]

List all known identities with their base62 public key representation

Link to this function

identity_key(identity, which)

View Source

Retrieve the key for a stored identity.

Can be either the :public or :secret key

Link to this function

log_at(author, seqnum, options \\ [])

View Source

Retrieve an author log at a particular sequence number. Includes the available certificate pool for its verification.

Using :max as the sequence number will use the latest

Link to this function

log_entry(author, seqnum, options \\ [])

View Source

Retreive a paticular entry by author and sequence number.

:max for the sequence number retrieves the latest known entry

Link to this function

log_range(author, range, options \\ [])

View Source

Retrieve all available author log entries over a specified range: {first, last}.

Link to this function

max_seqnum(author, options \\ [])

View Source

Retrieve the latest sequence number on a particular log identified by the author key and log number

Link to this function

optvals(opts, list, acc)

View Source
Link to this function

purge(author, options \\ [])

View Source

Purges a given log.

:all may be specified for author and/or the log_id option. Specifying both effectively clears the entire store.

Returns Baobab.stored_info/0

examples

Examples

iex> Baobab.purge(:all, log_id: :all) []

Link to this function

rename_identity(identity, new_name)

View Source
@spec rename_identity(String.t(), String.t()) :: String.t() | {:error, String.t()}

Rename an extant identity leaving its keys intact.

Link to this function

spool(which, clump_id, action, value \\ nil)

View Source
Link to this function

stored_info(clump_id \\ "default")

View Source

A list of {author, log_id, max_seqnum} tuples in the configured store