3#include <xrpl/basics/base_uint.h>
4#include <xrpl/basics/contract.h>
5#include <xrpl/nodestore/NodeObject.h>
6#include <xrpl/nodestore/Types.h>
62 open(
bool createIfMissing =
true) = 0;
79 open(
bool createIfMissing, uint64_t appType, uint64_t uid, uint64_t salt)
82 "Deterministic appType/uid/salt not supported by backend " +
getName());
162 [[nodiscard]]
virtual int
A backend used for the NodeStore.
virtual void close()=0
Close the backend.
virtual int getWriteLoad()=0
Estimate the number of write operations pending.
virtual bool isOpen()=0
Returns true is the database is open.
virtual ~Backend()=default
Destroy the backend.
virtual void verify()
Perform consistency checks on database.
virtual void store(std::shared_ptr< NodeObject > const &object)=0
Store a single object.
virtual void open(bool createIfMissing=true)=0
Open the backend.
virtual std::string getName()=0
Get the human-readable name of this backend.
virtual Status fetch(uint256 const &hash, std::shared_ptr< NodeObject > *pObject)=0
Fetch a single object.
virtual void open(bool createIfMissing, uint64_t appType, uint64_t uid, uint64_t salt)
Open the backend.
virtual std::optional< std::size_t > getBlockSize() const
Get the block size for backends that support it.
virtual void forEach(std::function< void(std::shared_ptr< NodeObject >)> f)=0
Visit every object in the database This is usually called during import.
virtual void storeBatch(Batch const &batch)=0
Store a group of objects.
virtual void setDeletePath()=0
Remove contents on disk upon destruction.
virtual int fdRequired() const =0
Returns the number of file descriptors the backend expects to need.
std::vector< std::shared_ptr< NodeObject > > Batch
A batch of NodeObjects to write at once.
Status
Return codes from Backend operations.
XRPL_NO_SANITIZE_ADDRESS void Throw(Args &&... args)