Kdb (Kdb v0.1.0)

Link to this section Summary

Link to this section Types

@type t() :: %Kdb{
  batch: reference() | nil,
  buckets: %{required(tname()) => Kdb.Bucket.t()},
  db: reference() | nil,
  folder: charlist(),
  global: Kdb.Bucket.t(),
  name: atom()
}
@type tname() :: atom() | binary()

Link to this section Functions

Link to this function

backup(kdb, target)

@spec backup(t(), charlist() | binary()) :: :ok | {:error, term()}
@spec batch(name :: atom() | String.t()) :: batch :: reference()
Link to this function

batch(kdb, name)

@spec batch(t(), name :: atom() | String.t()) :: t()
Link to this function

batch_load(map, dbfile, filename)

Link to this function

batch_save(map, filename)

Usage: tr = Kdb.get_tr(:blockchain) opts = [

init: {:seek, "ac_"},
direction: :next

] Kdb.foreach(tr, :accounts, fn key, value ->

# do something with key and value

end, opts)

Link to this function

binary_to_term(binary)

Link to this function

child_spec(opts)

Link to this function

commit(map, batch)

Link to this function

get_bucket(kdb, name)

Link to this function

key_merge(keys)

Link to this function

key_merge(key1, key2)

Link to this function

new(dbname, opts)

@spec new(dbname :: atom(), otps :: keyword()) :: t()

Open a new database.

options

Options

  • :folder - The folder to store the database.
  • :buckets - A list of buckets to create.
Link to this function

release_snapshot(snapshot)

@spec release_snapshot(t() | reference()) :: no_return()
Link to this function

restore(target, output)

@spec restore(charlist(), charlist()) :: :ok | {:error, term()}
Link to this function

snapshot(object)

@spec snapshot(t()) :: no_return()
Link to this function

start_link(opts)

Link to this function

term_to_binary(term)

Link to this function

transaction(kdb, fun)

@spec transaction(bucket :: t(), fun :: (t() -> any())) :: :ok | {:error, any()}