Browse Source

* use characters sets from Base.cpp - remove ABook class

pull/388/head
hagen 9 years ago
parent
commit
f190ee951c
  1. 34
      FS.cpp
  2. 10
      FS.h

34
FS.cpp

@ -24,24 +24,6 @@ namespace fs {
#endif #endif
HashedStorage NetDB("netDb", "r", "routerInfo-", "dat"); HashedStorage NetDB("netDb", "r", "routerInfo-", "dat");
HashedStorage Peers("peerProfiles", "p", "profile-", "txt"); HashedStorage Peers("peerProfiles", "p", "profile-", "txt");
ABookStorage ABook("addressbook", "b", "", "b32");
static const char T32[32] = {
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
'i', 'k', 'k', 'l', 'm', 'n', 'o', 'p',
'q', 'r', 't', 't', 'u', 'v', 'w', 'x',
'y', 'z', '2', '3', '4', '5', '6', '7',
};
static const char T64[64] = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y', 'z', '0', '1', '2', '3',
'4', '5', '6', '7', '8', '9', '-', '~'
};
const std::string & GetAppName () { const std::string & GetAppName () {
return appName; return appName;
@ -90,12 +72,10 @@ namespace fs {
if (boost::filesystem::exists(destinations)) if (boost::filesystem::exists(destinations))
boost::filesystem::create_directory(destinations); boost::filesystem::create_directory(destinations);
NetDB.SetRoot(dataDir); NetDB.SetPlace(dataDir);
NetDB.Init(T64, 64); NetDB.Init(i2p::data::GetBase64SubstitutionTable(), 64);
Peers.SetRoot(dataDir); Peers.SetPlace(dataDir);
Peers.Init(T64, 64); Peers.Init(i2p::data::GetBase64SubstitutionTable(), 64);
ABook.SetRoot(dataDir);
ABook.Init(T32, 32);
return true; return true;
} }
@ -177,13 +157,7 @@ namespace fs {
} }
} }
std::string ABookStorage::IndexPath() {
std::string path = root + i2p::fs::dirSep + "addresses.csv";
return path;
}
HashedStorage & GetNetDB() { return NetDB; } HashedStorage & GetNetDB() { return NetDB; }
HashedStorage & GetPeerProfiles() { return Peers; } HashedStorage & GetPeerProfiles() { return Peers; }
ABookStorage & GetAddressBook() { return ABook; }
} // fs } // fs
} // i2p } // i2p

10
FS.h

@ -49,15 +49,6 @@ namespace fs {
void Traverse(std::vector<std::string> & files); void Traverse(std::vector<std::string> & files);
}; };
/** @brief Slightly extended HashedStorage */
class ABookStorage : public HashedStorage {
public:
ABookStorage(const char *n, const char *p1, const char *p2, const char *s):
HashedStorage(n, p1, p2, s) {};
std::string IndexPath();
};
/** @brief Returns current application name, default 'i2pd' */ /** @brief Returns current application name, default 'i2pd' */
const std::string & GetAppName (); const std::string & GetAppName ();
/** @brief Set applicaton name, affects autodetection of datadir */ /** @brief Set applicaton name, affects autodetection of datadir */
@ -138,6 +129,5 @@ namespace fs {
/* accessors */ /* accessors */
HashedStorage & GetNetDB(); HashedStorage & GetNetDB();
HashedStorage & GetPeerProfiles(); HashedStorage & GetPeerProfiles();
ABookStorage & GetAddressBook();
} // fs } // fs
} // i2p } // i2p

Loading…
Cancel
Save