mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-19 18:15:50 +00:00
146 lines
3.0 KiB
C++
146 lines
3.0 KiB
C++
//------------------------------------------------------------------------------
|
|
/*
|
|
This file is part of rippled: https://github.com/ripple/rippled
|
|
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
*/
|
|
//==============================================================================
|
|
|
|
#include <ripple/basics/contract.h>
|
|
#include <ripple/nodestore/Factory.h>
|
|
#include <ripple/nodestore/Manager.h>
|
|
#include <memory>
|
|
|
|
namespace ripple {
|
|
namespace NodeStore {
|
|
|
|
class NullBackend : public Backend
|
|
{
|
|
public:
|
|
NullBackend() = default;
|
|
|
|
~NullBackend() = default;
|
|
|
|
std::string
|
|
getName() override
|
|
{
|
|
return std::string ();
|
|
}
|
|
|
|
void
|
|
open(bool createIfMissing) override
|
|
{
|
|
}
|
|
|
|
void
|
|
close() override
|
|
{
|
|
}
|
|
|
|
Status
|
|
fetch (void const*, std::shared_ptr<NodeObject>*) override
|
|
{
|
|
return notFound;
|
|
}
|
|
|
|
bool
|
|
canFetchBatch() override
|
|
{
|
|
return false;
|
|
}
|
|
|
|
std::vector<std::shared_ptr<NodeObject>>
|
|
fetchBatch (std::size_t n, void const* const* keys) override
|
|
{
|
|
Throw<std::runtime_error> ("pure virtual called");
|
|
return {};
|
|
}
|
|
|
|
void
|
|
store (std::shared_ptr<NodeObject> const& object) override
|
|
{
|
|
}
|
|
|
|
void
|
|
storeBatch (Batch const& batch) override
|
|
{
|
|
}
|
|
|
|
void
|
|
for_each (std::function <void(std::shared_ptr<NodeObject>)> f) override
|
|
{
|
|
}
|
|
|
|
int
|
|
getWriteLoad () override
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
void
|
|
setDeletePath() override
|
|
{
|
|
}
|
|
|
|
void
|
|
verify() override
|
|
{
|
|
}
|
|
|
|
/** Returns the number of file handles the backend expects to need */
|
|
int
|
|
fdlimit() const override
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
private:
|
|
};
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
class NullFactory : public Factory
|
|
{
|
|
public:
|
|
NullFactory()
|
|
{
|
|
Manager::instance().insert(*this);
|
|
}
|
|
|
|
~NullFactory() override
|
|
{
|
|
Manager::instance().erase(*this);
|
|
}
|
|
|
|
std::string
|
|
getName () const override
|
|
{
|
|
return "none";
|
|
}
|
|
|
|
std::unique_ptr <Backend>
|
|
createInstance (
|
|
size_t,
|
|
Section const&,
|
|
Scheduler&, beast::Journal) override
|
|
{
|
|
return std::make_unique <NullBackend> ();
|
|
}
|
|
};
|
|
|
|
static NullFactory nullFactory;
|
|
|
|
}
|
|
}
|