rippled
|
A backend used for the NodeStore. More...
Classes | |
struct | Counters |
Public Member Functions | |
virtual | ~Backend ()=default |
Destroy the backend. More... | |
virtual std::string | getName ()=0 |
Get the human-readable name of this backend. More... | |
virtual void | open (bool createIfMissing=true)=0 |
Open the backend. More... | |
virtual bool | isOpen ()=0 |
Returns true is the database is open. More... | |
virtual void | open (bool createIfMissing, uint64_t appType, uint64_t uid, uint64_t salt) |
Open the backend. More... | |
virtual void | close ()=0 |
Close the backend. More... | |
virtual Status | fetch (void const *key, std::shared_ptr< NodeObject > *pObject)=0 |
Fetch a single object. More... | |
virtual std::pair< std::vector< std::shared_ptr< NodeObject > >, Status > | fetchBatch (std::vector< uint256 const * > const &hashes)=0 |
Fetch a batch synchronously. More... | |
virtual void | store (std::shared_ptr< NodeObject > const &object)=0 |
Store a single object. More... | |
virtual void | storeBatch (Batch const &batch)=0 |
Store a group of objects. More... | |
virtual void | sync ()=0 |
virtual void | for_each (std::function< void(std::shared_ptr< NodeObject >)> f)=0 |
Visit every object in the database This is usually called during import. More... | |
virtual int | getWriteLoad ()=0 |
Estimate the number of write operations pending. More... | |
virtual void | setDeletePath ()=0 |
Remove contents on disk upon destruction. More... | |
virtual void | verify () |
Perform consistency checks on database. More... | |
virtual int | fdRequired () const =0 |
Returns the number of file descriptors the backend expects to need. More... | |
virtual std::optional< Counters< std::uint64_t > > | counters () const |
Returns read and write stats. More... | |
A backend used for the NodeStore.
The NodeStore uses a swappable backend so that other database systems can be tried. Different databases may offer various features such as improved performance, fault tolerant or distributed storage, or all in-memory operation.
A given instance of a backend is fixed to a particular key size.
|
virtualdefault |
Destroy the backend.
All open files are closed and flushed. If there are batched writes or other tasks scheduled, they will be completed before this call returns.
|
pure virtual |
Get the human-readable name of this backend.
This is used for diagnostic output.
Implemented in ripple::NodeStore::NuDBBackend, ripple::NodeStore::MemoryBackend, and ripple::NodeStore::NullBackend.
|
pure virtual |
Open the backend.
createIfMissing | Create the database files if necessary. This allows the caller to catch exceptions. |
Implemented in ripple::NodeStore::NuDBBackend, ripple::NodeStore::MemoryBackend, and ripple::NodeStore::NullBackend.
|
pure virtual |
Returns true is the database is open.
Implemented in ripple::NodeStore::NuDBBackend, ripple::NodeStore::MemoryBackend, and ripple::NodeStore::NullBackend.
|
virtual |
Open the backend.
createIfMissing | Create the database files if necessary. |
appType | Deterministic appType used to create a backend. |
uid | Deterministic uid used to create a backend. |
salt | Deterministic salt used to create a backend. |
std::runtime_error | is function is called not for NuDB backend. |
Reimplemented in ripple::NodeStore::NuDBBackend.
|
pure virtual |
Close the backend.
This allows the caller to catch exceptions.
Implemented in ripple::NodeStore::NuDBBackend, ripple::NodeStore::MemoryBackend, and ripple::NodeStore::NullBackend.
|
pure virtual |
Fetch a single object.
If the object is not found or an error is encountered, the result will indicate the condition.
key | A pointer to the key data. |
pObject | [out] The created object if successful. |
Implemented in ripple::NodeStore::MemoryBackend, ripple::NodeStore::NuDBBackend, and ripple::NodeStore::NullBackend.
|
pure virtual |
Fetch a batch synchronously.
Implemented in ripple::NodeStore::NuDBBackend, ripple::NodeStore::MemoryBackend, and ripple::NodeStore::NullBackend.
|
pure virtual |
Store a single object.
Depending on the implementation this may happen immediately or deferred using a scheduled task.
object | The object to store. |
Implemented in ripple::NodeStore::MemoryBackend, ripple::NodeStore::NullBackend, and ripple::NodeStore::NuDBBackend.
|
pure virtual |
Store a group of objects.
Implemented in ripple::NodeStore::NuDBBackend, ripple::NodeStore::MemoryBackend, and ripple::NodeStore::NullBackend.
|
pure virtual |
Implemented in ripple::NodeStore::NuDBBackend, ripple::NodeStore::MemoryBackend, and ripple::NodeStore::NullBackend.
|
pure virtual |
Visit every object in the database This is usually called during import.
Implemented in ripple::NodeStore::NuDBBackend, ripple::NodeStore::MemoryBackend, and ripple::NodeStore::NullBackend.
|
pure virtual |
Estimate the number of write operations pending.
Implemented in ripple::NodeStore::NuDBBackend, ripple::NodeStore::MemoryBackend, and ripple::NodeStore::NullBackend.
|
pure virtual |
Remove contents on disk upon destruction.
Implemented in ripple::NodeStore::NuDBBackend, ripple::NodeStore::MemoryBackend, and ripple::NodeStore::NullBackend.
|
virtual |
Perform consistency checks on database.
This method is implemented only by NuDBBackend. It is not yet called anywhere, but it might be a good idea to one day call it at startup to avert a crash.
Reimplemented in ripple::NodeStore::NuDBBackend.
|
pure virtual |
Returns the number of file descriptors the backend expects to need.
Implemented in ripple::NodeStore::NuDBBackend, ripple::NodeStore::MemoryBackend, and ripple::NodeStore::NullBackend.
|
virtual |