# `Ankusa.Intake.Memory`
[🔗](https://github.com/jamescarr/ankusa/blob/ankusa-v0.7.0/packages/ankusa/lib/ankusa/intake/memory.ex#L1)

An in-memory `Ankusa.Intake` for tests, benches and the fleet drill's fake. Not
a production mode: its "replicas" are one process.

Options (`intake.memory`): `path` (a file every record is appended to and the
log is reloaded from at start, so a replacement node started on an empty data
directory finds the log of the node it replaces) and `latency_ms` (every
confirm is delayed by it).

Faults are injected per call, by instance, from a test:

  * `fail(instance, class, count)` — the next `count` publishes answer
    `{:error, class}` and store **nothing**
  * `lost_ack(instance, class, count)` — the next `count` publishes **store**
    the batch and answer `{:error, class}` (a timeout the broker completed)
  * `hold(instance)` / `release(instance)` — publishes wait, unanswered
  * `hold_replay(instance)` / `release_replay(instance)` — replay waits
  * `set_latency/2`, `set_ready/2`, `set_verify/2`, `set_earliest/2`
  * `put_raw(instance, record)` — a record as it would sit in the log

`records/1` reads the log back.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `fail`

The next `count` publishes (default: all) fail with `class` and store nothing.

# `heal`

Clears every injected publish fault.

# `hold`

# `hold_replay`

# `lost_ack`

The next `count` publishes store the batch and answer `class`: a lost ack.

# `publish_calls`

How many publish calls the log has seen (confirmed or not).

# `put_raw`

A record exactly as it sits in the log (a test of unknown kinds and versions).

# `records`

Every record of the log, in position order.

# `release`

# `release_replay`

# `set_earliest`

# `set_latency`

# `set_ready`

# `set_verify`

# `start_link`

---

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