Slap.SlateDB.Snapshot (slap_slatedb v0.2.0)

Copy Markdown View Source

A consistent, read-only view of the database at the time it was taken.

Create one with Slap.SlateDB.snapshot/1. Writes made after the snapshot are not visible through it.

Summary

Functions

Reads key as of the snapshot. Takes the options of Slap.SlateDB.get/3.

Reads key with its metadata as of the snapshot, like Slap.SlateDB.get_key_value/3.

Opens a Slap.SlateDB.Iterator as of the snapshot. Takes the options of Slap.SlateDB.iterator/2.

Scans rows as of the snapshot. Takes the same options as Slap.SlateDB.scan/2.

Types

t()

@opaque t()

Functions

get(snapshot, key, opts \\ [])

@spec get(t(), binary(), keyword()) ::
  {:ok, binary() | nil} | {:error, Slap.SlateDB.Error.t()}

Reads key as of the snapshot. Takes the options of Slap.SlateDB.get/3.

get_key_value(snapshot, key, opts \\ [])

@spec get_key_value(t(), binary(), keyword()) ::
  {:ok, Slap.SlateDB.key_value() | nil} | {:error, Slap.SlateDB.Error.t()}

Reads key with its metadata as of the snapshot, like Slap.SlateDB.get_key_value/3.

iterator(snapshot, opts \\ [])

@spec iterator(t(), keyword()) ::
  {:ok, Slap.SlateDB.Iterator.t()} | {:error, Slap.SlateDB.Error.t()}

Opens a Slap.SlateDB.Iterator as of the snapshot. Takes the options of Slap.SlateDB.iterator/2.

scan(snapshot, opts \\ [])

@spec scan(t(), keyword()) :: Enumerable.t()

Scans rows as of the snapshot. Takes the same options as Slap.SlateDB.scan/2.