Archived
1
0
This repository has been archived on 2023-08-12. You can view files and clone it, but cannot push or open issues or pull requests.
nntpchan/contrib/backends/nntpchan-daemon/libnntpchan/storage.hpp

41 lines
740 B
C++
Raw Normal View History

#ifndef NNTPCHAN_STORAGE_HPP
#define NNTPCHAN_STORAGE_HPP
#include <experimental/filesystem>
#include <string>
#include "file_handle.hpp"
namespace nntpchan
{
namespace fs = std::experimental::filesystem;
class ArticleStorage
{
public:
ArticleStorage();
ArticleStorage(const fs::path & fpath);
~ArticleStorage();
void SetPath(const fs::path & fpath);
FileHandle_ptr OpenWrite(const std::string & msgid);
FileHandle_ptr OpenRead(const std::string & msgid);
/**
return true if we should accept a new message give its message id
*/
bool Accept(const std::string & msgid);
private:
fs::path MessagePath(const std::string & msgid);
fs::path basedir;
};
}
#endif