comparison Core/FileStorage/FilesystemStorage.h @ 1124:790ff7a5b3bf

IStorageArea abstraction
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 05 Sep 2014 16:28:34 +0200
parents 6c5a77637b23
children bf67431a7383
comparison
equal deleted inserted replaced
1123:6c5a77637b23 1124:790ff7a5b3bf
30 **/ 30 **/
31 31
32 32
33 #pragma once 33 #pragma once
34 34
35 #include "IStorageArea.h"
36
35 #include <boost/filesystem.hpp> 37 #include <boost/filesystem.hpp>
36 #include <set> 38 #include <set>
37 39
38 namespace Orthanc 40 namespace Orthanc
39 { 41 {
40 class FilesystemStorage : public boost::noncopyable 42 class FilesystemStorage : public IStorageArea
41 { 43 {
42 // TODO REMOVE THIS 44 // TODO REMOVE THIS
43 friend class FilesystemHttpSender; 45 friend class FilesystemHttpSender;
44 friend class FileStorageAccessor; 46 friend class FileStorageAccessor;
45 47
49 boost::filesystem::path GetPath(const std::string& uuid) const; 51 boost::filesystem::path GetPath(const std::string& uuid) const;
50 52
51 public: 53 public:
52 FilesystemStorage(std::string root); 54 FilesystemStorage(std::string root);
53 55
54 std::string Create(const void* content, size_t size); 56 virtual std::string Create(const void* content, size_t size);
55 57
56 std::string Create(const std::vector<uint8_t>& content); 58 virtual void Read(std::string& content,
59 const std::string& uuid) const;
57 60
58 std::string Create(const std::string& content); 61 virtual void Remove(const std::string& uuid);
59
60 void Read(std::string& content,
61 const std::string& uuid) const;
62 62
63 void ListAllFiles(std::set<std::string>& result) const; 63 void ListAllFiles(std::set<std::string>& result) const;
64 64
65 uintmax_t GetSize(const std::string& uuid) const; 65 uintmax_t GetSize(const std::string& uuid) const;
66 66
67 void Clear(); 67 void Clear();
68 68
69 void Remove(const std::string& uuid);
70
71 uintmax_t GetCapacity() const; 69 uintmax_t GetCapacity() const;
72 70
73 uintmax_t GetAvailableSpace() const; 71 uintmax_t GetAvailableSpace() const;
74 }; 72 };
75 } 73 }