mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Add null backend factory
This commit is contained in:
71
modules/ripple_app/node/ripple_NullBackendFactory.cpp
Normal file
71
modules/ripple_app/node/ripple_NullBackendFactory.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
class NullBackendFactory::Backend : public NodeStore::Backend
|
||||
{
|
||||
public:
|
||||
Backend ()
|
||||
{
|
||||
}
|
||||
|
||||
~Backend ()
|
||||
{
|
||||
}
|
||||
|
||||
std::string getDataBaseName()
|
||||
{
|
||||
return std::string ();
|
||||
}
|
||||
|
||||
bool store (NodeObject::ref obj)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool bulkStore (const std::vector< NodeObject::pointer >& objs)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
NodeObject::pointer retrieve (uint256 const& hash)
|
||||
{
|
||||
return NodeObject::pointer ();
|
||||
}
|
||||
|
||||
void visitAll (FUNCTION_TYPE <void (NodeObject::pointer)> func)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
NullBackendFactory::NullBackendFactory ()
|
||||
{
|
||||
}
|
||||
|
||||
NullBackendFactory::~NullBackendFactory ()
|
||||
{
|
||||
}
|
||||
|
||||
NullBackendFactory& NullBackendFactory::getInstance ()
|
||||
{
|
||||
static NullBackendFactory instance;
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
String NullBackendFactory::getName () const
|
||||
{
|
||||
return "none";
|
||||
}
|
||||
|
||||
NodeStore::Backend* NullBackendFactory::createInstance (StringPairArray const& keyValues)
|
||||
{
|
||||
return new NullBackendFactory::Backend;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
29
modules/ripple_app/node/ripple_NullBackendFactory.h
Normal file
29
modules/ripple_app/node/ripple_NullBackendFactory.h
Normal file
@@ -0,0 +1,29 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_NULLBACKENDFACTORY_H_INCLUDED
|
||||
#define RIPPLE_NULLBACKENDFACTORY_H_INCLUDED
|
||||
|
||||
/** Factory to produce a null backend.
|
||||
|
||||
This is for standalone / testing mode.
|
||||
*/
|
||||
class NullBackendFactory : public NodeStore::BackendFactory
|
||||
{
|
||||
private:
|
||||
class Backend;
|
||||
|
||||
NullBackendFactory ();
|
||||
~NullBackendFactory ();
|
||||
|
||||
public:
|
||||
static NullBackendFactory& getInstance ();
|
||||
|
||||
String getName () const;
|
||||
NodeStore::Backend* createInstance (StringPairArray const& keyValues);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -96,8 +96,9 @@ namespace ripple
|
||||
|
||||
#include "node/ripple_NodeObject.h"
|
||||
#include "node/ripple_NodeStore.h"
|
||||
#include "node/ripple_SqliteBackendFactory.h"
|
||||
#include "node/ripple_LevelDBBackendFactory.h"
|
||||
#include "node/ripple_NullBackendFactory.h"
|
||||
#include "node/ripple_SqliteBackendFactory.h"
|
||||
|
||||
#include "src/cpp/ripple/ripple_SHAMapItem.h"
|
||||
#include "src/cpp/ripple/ripple_SHAMapNode.h"
|
||||
@@ -237,6 +238,7 @@ static const uint64 tenTo17m1 = tenTo17 - 1;
|
||||
#include "node/ripple_NodeObject.cpp"
|
||||
#include "node/ripple_NodeStore.cpp"
|
||||
#include "node/ripple_LevelDBBackendFactory.cpp"
|
||||
#include "node/ripple_NullBackendFactory.cpp"
|
||||
#include "node/ripple_SqliteBackendFactory.cpp"
|
||||
|
||||
#include "src/cpp/ripple/Ledger.cpp"
|
||||
|
||||
Reference in New Issue
Block a user