leo_backend_db_api

leo_backend_db’s API.

References

Description

leo_backend_db’s API

Function Index

delete/2 Delete an object from backend-db.
fetch/3 Fetch objects from backend-db by key with function.
fetch/4  
finish_compaction/2 End the data-compaction.
first/1 Retrieve a first record from backend-db.
get/2 Retrieve an object from backend-db.
get_db_raw_filepath/1 get the database filepath for calculating disk size.
new/4 create storage-processes.
put/3 Insert an object into backend-db.
put_value_to_new_db/3 Put a record to a new db.
run_compaction/1 Start the data-compaction.
status/1 Retrieve status from backend-db.
stop/1 Stop the instance.

Function Details

delete/2

delete(InstanceName, KeyBin) -> ok | {error, any()}

  • InstanceName = atom()
  • KeyBin = binary()

Delete an object from backend-db.

fetch/3

fetch(InstanceName, KeyBin, Fun) -> {ok, list()} | not_found | {error, any()}

  • InstanceName = atom()
  • KeyBin = binary()
  • Fun = function()

Fetch objects from backend-db by key with function.

fetch/4

fetch(InstanceName, KeyBin, Fun, MaxKeys) -> {ok, list()} | not_found | {error, any()}

  • InstanceName = atom()
  • KeyBin = binary()
  • Fun = function()
  • MaxKeys = pos_integer()

finish_compaction/2

finish_compaction(InstanceName, Commit) -> ok | {error, any()}

  • InstanceName = atom()
  • Commit = boolean()

End the data-compaction

first/1

first(InstanceName) -> {ok, list()} | {error, any()}

  • InstanceName = atom()

Retrieve a first record from backend-db.

get/2

get(InstanceName, KeyBin) -> {ok, binary()} | not_found | {error, any()}

  • InstanceName = atom()
  • KeyBin = binary()

Retrieve an object from backend-db.

get_db_raw_filepath/1

get_db_raw_filepath(InstanceName) -> {ok, string()} | {error, any()}

  • InstanceName = atom()

get the database filepath for calculating disk size

new/4

new(InstanceName, NumOfDBProcs, BackendDB, DBRootPath) -> ok | {error, any()}

  • InstanceName = atom()
  • NumOfDBProcs = pos_integer()
  • BackendDB = backend_db()
  • DBRootPath = string()

create storage-processes.

put/3

put(InstanceName, KeyBin, ValueBin) -> ok | {error, any()}

  • InstanceName = atom()
  • KeyBin = binary()
  • ValueBin = binary()

Insert an object into backend-db.

put_value_to_new_db/3

put_value_to_new_db(InstanceName, KeyBin, ValueBin) -> ok | {error, any()}

  • InstanceName = atom()
  • KeyBin = binary()
  • ValueBin = binary()

Put a record to a new db

run_compaction/1

run_compaction(InstanceName) -> ok | {error, any()}

  • InstanceName = atom()

Start the data-compaction

status/1

status(InstanceName) -> [{atom(), term()}]

  • InstanceName = atom()

Retrieve status from backend-db.

stop/1

stop(InstanceName) -> ok | {error, any()}

  • InstanceName = atom()

Stop the instance