1#include <xrpl/basics/contract.h> 
    2#include <xrpl/nodestore/Factory.h> 
    3#include <xrpl/nodestore/Manager.h> 
    5#include <boost/beast/core/string.hpp> 
    6#include <boost/core/ignore_unused.hpp> 
   49        auto const result = 
map_.emplace(
 
   53            Throw<std::runtime_error>(
"already open");
 
 
 
   87            Throw<std::runtime_error>(
"Missing path in Memory backend");
 
 
  110        return static_cast<bool>(
db_);
 
 
  125            db_, 
"ripple::NodeStore::MemoryBackend::fetch : non-null database");
 
  130        Map::iterator iter = 
db_->
table.find(hash);
 
  136        *pObject = iter->second;
 
 
  145        for (
auto const& h : hashes)
 
  155        return {results, 
ok};
 
 
  162            db_, 
"ripple::NodeStore::MemoryBackend::store : non-null database");
 
  164        db_->
table.emplace(object->getHash(), 
object);
 
 
  170        for (
auto const& e : 
batch)
 
 
  184            "ripple::NodeStore::MemoryBackend::for_each : non-null database");
 
 
 
A generic endpoint for log messages.
 
A backend used for the NodeStore.
 
Base class for backend factories.
 
Singleton for managing NodeStore factories and back ends.
 
virtual void insert(Factory &factory)=0
Add a factory.
 
void close() override
Close the backend.
 
void store(std::shared_ptr< NodeObject > const &object) override
Store a single object.
 
std::string getName() override
Get the human-readable name of this backend.
 
~MemoryBackend() override
 
std::pair< std::vector< std::shared_ptr< NodeObject > >, Status > fetchBatch(std::vector< uint256 const * > const &hashes) override
Fetch a batch synchronously.
 
MemoryBackend(size_t keyBytes, Section const &keyValues, beast::Journal journal)
 
void for_each(std::function< void(std::shared_ptr< NodeObject >)> f) override
Visit every object in the database This is usually called during import.
 
int getWriteLoad() override
Estimate the number of write operations pending.
 
void storeBatch(Batch const &batch) override
Store a group of objects.
 
void open(bool) override
Open the backend.
 
void setDeletePath() override
Remove contents on disk upon destruction.
 
int fdRequired() const override
Returns the number of file descriptors the backend expects to need.
 
Status fetch(void const *key, std::shared_ptr< NodeObject > *pObject) override
Fetch a single object.
 
bool isOpen() override
Returns true is the database is open.
 
beast::Journal const journal_
 
std::string getName() const override
Retrieve the name of this factory.
 
std::map< std::string, MemoryDB, boost::beast::iless > map_
 
MemoryFactory(Manager &manager)
 
std::unique_ptr< Backend > createInstance(size_t keyBytes, Section const &keyValues, std::size_t burstSize, Scheduler &scheduler, beast::Journal journal) override
Create an instance of this factory's backend.
 
MemoryDB & open(std::string const &path)
 
Scheduling for asynchronous backend activity.
 
Holds a collection of configuration values.
 
static base_uint fromVoid(void const *data)
 
MemoryFactory * memoryFactory
 
void registerMemoryFactory(Manager &manager)
 
Status
Return codes from Backend operations.
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
T get(Section const §ion, std::string const &name, T const &defaultValue=T{})
Retrieve a key/value pair from a section.
 
std::map< uint256 const, std::shared_ptr< NodeObject > > table