const std::string getFileName(const std::string &key)
{
- KeyGenerator::data hash = KeyGenerator::MD5(KeyGenerator::data(key.begin(), key.end()));
+ BinaryData hash = KeyGenerator::SHA256(BinaryData(key.begin(), key.end()));
std::stringstream fileName;
fileName << "/opt/etc/.ode_";
return file.exists();
}
-const FileFooter::data FileFooter::read(const std::string &key)
+const BinaryData FileFooter::read(const std::string &key)
{
std::string fileName(getFileName(key));
INFO(SINK, "Footer file : " + fileName);
runtime::File file(fileName);
- data value(file.size());
+ BinaryData value(file.size());
file.open(O_RDONLY);
file.read(value.data(), value.size());
return value;
}
-void FileFooter::write(const std::string &key, const data &value)
+void FileFooter::write(const std::string &key, const BinaryData &value)
{
std::string fileName(getFileName(key));
runtime::File file(fileName);
- file.create(0600);
+ if (!file.exists()) {
+ file.create(S_IRUSR | S_IWUSR);
+ } else {
+ file.open(O_RDWR);
+ }
+
file.write(value.data(), value.size());
}