DBService¶
DBService
handles all interaction with the user’s local database.
Currently, all services talk to ChainService to interact with the database instead of talking with DBService
directly.
Backends¶
plasma-core
uses key-value store when storing information in the database.
plasma-core
provides serveral different backends for DBService
depending on the user’s preference.
DBService
supports:
EphemDBProvider
, an in-memory database (mostly for testing).LevelDBProvider
, a wrapper for LevelDB.
get¶
db.get(key)
Returns the value stored at the given key.
Parameters¶
key
-String
: The key to query.
Returns¶
any
: The value stored at that key.
set¶
db.set(key, value)
Stores a value at the given key.
Parameters¶
key
-String
: The key to set.value
-any
: The value to store.
delete¶
db.delete(key)
Deletes the value at a given key.
Parameters¶
key
-String
: The key to delete.