# `Baobab`
[🔗](https://github.com/mwmiller/baobab_ex/blob/main/lib/baobab.ex#L1)

Baobab is a pure Elixir implementation of the
[Bamboo](https://github.com/AljoschaMeyer/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

config :baobab, spool_dir: "/tmp"

### 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`

# `all_entries`

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

# `all_seqnum`

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

# `append_log`

Create and store a new log entry for a stored identity

# `clumps`

Retrieve a list of all available clumps

# `compact`

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

# `create_clump`

Create a clump

# `drop_clump`

Drop a clump

# `full_log`

Retrieve all available entries in a particular log

# `log_at`

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

# `log_entry`

Retreive a paticular entry by author and sequence number.

`:max` for the sequence number retrieves the latest known entry

# `log_range`

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

# `max_seqnum`

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

# `optvals`

# `purge`

Purges a given log.

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

Returns `stored_info/0`

## Examples

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

# `stored_info`

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
