Bedrock.DataPlane.Materializer.Olivine.CompactionWriter behaviour (bedrock v0.5.2)

View Source

Behaviour for compaction output writers.

Allows compaction to output to different formats:

  • SplitFile: Two separate files (data + index) for local use
  • Bundle: Single file with data followed by index, for ObjectStorage upload

Summary

Callbacks

Finish writing and return the result. Implementations should sync files to disk before returning.

Write data bytes to the compacted output.

Write index bytes to the compacted output.

Functions

Dispatch finish to the implementation module.

Dispatch write_data to the implementation module.

Dispatch write_index to the implementation module.

Types

result()

@type result() :: term()

t()

@type t() :: term()

Callbacks

finish(t)

@callback finish(t()) :: {:ok, result()} | {:error, term()}

Finish writing and return the result. Implementations should sync files to disk before returning.

write_data(t, iodata)

@callback write_data(t(), iodata()) :: {:ok, t()} | {:error, term()}

Write data bytes to the compacted output.

write_index(t, iodata)

@callback write_index(t(), iodata()) :: {:ok, t()} | {:error, term()}

Write index bytes to the compacted output.

Functions

finish(module, writer)

@spec finish(module(), t()) :: {:ok, result()} | {:error, term()}

Dispatch finish to the implementation module.

write_data(module, writer, iodata)

@spec write_data(module(), t(), iodata()) :: {:ok, t()} | {:error, term()}

Dispatch write_data to the implementation module.

write_index(module, writer, iodata)

@spec write_index(module(), t(), iodata()) :: {:ok, t()} | {:error, term()}

Dispatch write_index to the implementation module.