Browse Source

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

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

34
FS.cpp

@ -24,24 +24,6 @@ namespace fs { @@ -24,24 +24,6 @@ namespace fs {
#endif
HashedStorage NetDB("netDb", "r", "routerInfo-", "dat");
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 () {
return appName;
@ -90,12 +72,10 @@ namespace fs { @@ -90,12 +72,10 @@ namespace fs {
if (boost::filesystem::exists(destinations))
boost::filesystem::create_directory(destinations);
NetDB.SetRoot(dataDir);
NetDB.Init(T64, 64);
Peers.SetRoot(dataDir);
Peers.Init(T64, 64);
ABook.SetRoot(dataDir);
ABook.Init(T32, 32);
NetDB.SetPlace(dataDir);
NetDB.Init(i2p::data::GetBase64SubstitutionTable(), 64);
Peers.SetPlace(dataDir);
Peers.Init(i2p::data::GetBase64SubstitutionTable(), 64);
return true;
}
@ -177,13 +157,7 @@ namespace fs { @@ -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 & GetPeerProfiles() { return Peers; }
ABookStorage & GetAddressBook() { return ABook; }
} // fs
} // i2p

10
FS.h

@ -49,15 +49,6 @@ namespace fs { @@ -49,15 +49,6 @@ namespace fs {
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' */
const std::string & GetAppName ();
/** @brief Set applicaton name, affects autodetection of datadir */
@ -138,6 +129,5 @@ namespace fs { @@ -138,6 +129,5 @@ namespace fs {
/* accessors */
HashedStorage & GetNetDB();
HashedStorage & GetPeerProfiles();
ABookStorage & GetAddressBook();
} // fs
} // i2p

Loading…
Cancel
Save