BAM.Sink behaviour (BAM v0.1.0)

Copy Markdown View Source

Byte sink for the BAM writer.

write/2 appends iodata. close/1 releases the sink. BAM.Sink.File writes a local file. BAM.Sink.Memory keeps the bytes so a test can inspect them without touching the filesystem.

Summary

Types

Opaque handle owned by one sink implementation.

Types

state()

@type state() :: term()

Opaque handle owned by one sink implementation.

Callbacks

close(state)

@callback close(state()) :: {:ok, state()} | {:error, BAM.Error.t()}

write(state, iodata)

@callback write(state(), iodata()) :: {:ok, state()} | {:error, BAM.Error.t()}