//------------------------------------------------------------------------------ /* 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 #include #include #include 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*) override { return notFound; } bool canFetchBatch() override { return false; } std::vector> fetchBatch (std::size_t n, void const* const* keys) override { Throw ("pure virtual called"); return {}; } void store (std::shared_ptr const& object) override { } void storeBatch (Batch const& batch) override { } void for_each (std::function )> 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 createInstance ( size_t, Section const&, Scheduler&, beast::Journal) override { return std::make_unique (); } }; static NullFactory nullFactory; } }