mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-23 20:27:37 +01:00
Adding an option to choose storage engine
This commit is contained in:
parent
ef4e11f00a
commit
8a8ea9d5d4
3 changed files with 20 additions and 2 deletions
|
@ -231,6 +231,11 @@ namespace config {
|
|||
("exploratory.outbound.quantity", value<int>()->default_value(3), "Exploratory outbound tunnels quantity")
|
||||
;
|
||||
|
||||
options_description storage("Persistent storage options for NetDb, profiles, etc.");
|
||||
storage.add_options()
|
||||
("storage.engine", value<std::string>()->default_value("fs"), "Storage engine")
|
||||
;
|
||||
|
||||
m_OptionsDesc
|
||||
.add(general)
|
||||
.add(limits)
|
||||
|
@ -248,6 +253,7 @@ namespace config {
|
|||
.add(trust)
|
||||
.add(websocket)
|
||||
.add(exploratory)
|
||||
.add(storage)
|
||||
;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,13 @@ namespace data
|
|||
|
||||
void NetDb::Start ()
|
||||
{
|
||||
std::string engine;
|
||||
i2p::config::GetOption("storage.engine", engine);
|
||||
if (engine == "lmdb")
|
||||
m_Storage.reset(new MdbIdentStorage("netDb.lmdb"));
|
||||
else
|
||||
m_Storage.reset(new FsIdentStorage("netDb", "r", "routerInfo-", "dat"));
|
||||
|
||||
m_Storage->Init();
|
||||
InitProfilesStorage ();
|
||||
m_Families.LoadCertificates ();
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/property_tree/ini_parser.hpp>
|
||||
#include "Base.h"
|
||||
#include "Config.h"
|
||||
#include "FS.h"
|
||||
#include "Log.h"
|
||||
#include "Profiling.h"
|
||||
|
@ -173,6 +174,11 @@ namespace data
|
|||
|
||||
void InitProfilesStorage ()
|
||||
{
|
||||
std::string engine;
|
||||
i2p::config::GetOption("storage.engine", engine);
|
||||
if (engine == "lmdb")
|
||||
m_ProfilesStorage.reset(new MdbIdentStorage("peerProfiles.lmdb"));
|
||||
else
|
||||
m_ProfilesStorage.reset(new FsIdentStorage("peerProfiles", "p", "profile-", "txt"));
|
||||
m_ProfilesStorage->Init();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue