diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-09-13 19:04:14 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-09-13 19:04:14 +0200 |
commit | 7f4f260d732c849c1e88fcb91023faab5316d9c6 (patch) | |
tree | f58ad5026eee9cb0c2c8e8742147f29404cdd721 /src/modules/StorageBackendFile/StorageBackendFile.cpp | |
parent | 09b8df5200de1c8c20ea2856a8c6aa76b0811bd1 (diff) | |
download | mad-7f4f260d732c849c1e88fcb91023faab5316d9c6.tar mad-7f4f260d732c849c1e88fcb91023faab5316d9c6.zip |
StorageManager can delete stored data now
Diffstat (limited to 'src/modules/StorageBackendFile/StorageBackendFile.cpp')
-rw-r--r-- | src/modules/StorageBackendFile/StorageBackendFile.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/modules/StorageBackendFile/StorageBackendFile.cpp b/src/modules/StorageBackendFile/StorageBackendFile.cpp index 7c952bd..c8bc4f7 100644 --- a/src/modules/StorageBackendFile/StorageBackendFile.cpp +++ b/src/modules/StorageBackendFile/StorageBackendFile.cpp @@ -116,6 +116,18 @@ std::set<std::string> StorageBackendFile::list(const std::string &type) throw (C return ret; } + +bool StorageBackendFile::exists(const std::string &type, const std::string &name) throw (Core::Exception) { + boost::shared_lock<boost::shared_mutex> lock(mutex); + + if(!configured) + throw Core::Exception(Core::Exception::NOT_AVAILABLE); + + boost::filesystem::path path = getFileName(type, name); + + return boost::filesystem::is_regular_file(path); +} + void StorageBackendFile::store(const std::string &type, const std::string &name, const Common::XmlData *data) throw (Core::Exception) { boost::lock_guard<boost::shared_mutex> lock(mutex); @@ -138,6 +150,16 @@ boost::shared_ptr<Common::XmlData> StorageBackendFile::load(const std::string &t return boost::shared_ptr<Common::XmlData>(new Common::XmlData(path.file_string())); } +void StorageBackendFile::remove(const std::string &type, const std::string &name) throw (Core::Exception) { + boost::lock_guard<boost::shared_mutex> lock(mutex); + + if(!configured) + throw Core::Exception(Core::Exception::NOT_AVAILABLE); + + boost::filesystem::path path = getFileName(type, name); + boost::filesystem::remove(path); +} + } } } |