mirror of
https://github.com/TomHarte/CLK.git
synced 2025-12-18 22:19:30 +00:00
Add delegate to validate on a file-by-file basis.
This commit is contained in:
@@ -23,11 +23,17 @@ namespace Storage::FileBundle {
|
||||
bundles in the future.
|
||||
*/
|
||||
struct FileBundle {
|
||||
struct PermissionDelegate {
|
||||
virtual void validate_open(const std::string &, FileMode) = 0;
|
||||
virtual void validate_erase(const std::string &) = 0;
|
||||
};
|
||||
|
||||
virtual std::optional<std::string> key_file() = 0;
|
||||
virtual FileHolder open(const std::string &, FileMode) = 0;
|
||||
virtual bool erase(const std::string &) = 0;
|
||||
|
||||
virtual std::optional<std::string> base_path() = 0;
|
||||
virtual void set_permission_delegate(PermissionDelegate *) = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -39,10 +45,12 @@ struct LocalFSFileBundle: public FileBundle {
|
||||
bool erase(const std::string &) override;
|
||||
|
||||
std::optional<std::string> base_path() override;
|
||||
void set_permission_delegate(PermissionDelegate *) override;
|
||||
|
||||
private:
|
||||
std::string key_file_;
|
||||
std::string base_path_;
|
||||
PermissionDelegate *permission_delegate_ = nullptr;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user