comparison OrthancServer/ServerIndex.cpp @ 1126:bf67431a7383

handling of file content type in IStorageArea
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 05 Sep 2014 17:01:42 +0200
parents ba5c0908600c
children 514492f61ead
comparison
equal deleted inserted replaced
1125:20ddab7e9ae8 1126:bf67431a7383
57 namespace Internals 57 namespace Internals
58 { 58 {
59 class ServerIndexListener : public IServerIndexListener 59 class ServerIndexListener : public IServerIndexListener
60 { 60 {
61 private: 61 private:
62 struct FileToRemove
63 {
64 std::string uuid_;
65 FileContentType type_;
66
67 FileToRemove(const FileInfo& info) : uuid_(info.GetUuid()),
68 type_(info.GetContentType())
69 {
70 }
71 };
72
62 ServerContext& context_; 73 ServerContext& context_;
63 bool hasRemainingLevel_; 74 bool hasRemainingLevel_;
64 ResourceType remainingType_; 75 ResourceType remainingType_;
65 std::string remainingPublicId_; 76 std::string remainingPublicId_;
66 std::list<std::string> pendingFilesToRemove_; 77 std::list<FileToRemove> pendingFilesToRemove_;
67 uint64_t sizeOfFilesToRemove_; 78 uint64_t sizeOfFilesToRemove_;
68 79
69 public: 80 public:
70 ServerIndexListener(ServerContext& context) : 81 ServerIndexListener(ServerContext& context) :
71 context_(context) 82 context_(context)
88 return sizeOfFilesToRemove_; 99 return sizeOfFilesToRemove_;
89 } 100 }
90 101
91 void CommitFilesToRemove() 102 void CommitFilesToRemove()
92 { 103 {
93 for (std::list<std::string>::iterator 104 for (std::list<FileToRemove>::iterator
94 it = pendingFilesToRemove_.begin(); 105 it = pendingFilesToRemove_.begin();
95 it != pendingFilesToRemove_.end(); ++it) 106 it != pendingFilesToRemove_.end(); ++it)
96 { 107 {
97 context_.RemoveFile(*it); 108 context_.RemoveFile(it->uuid_, it->type_);
98 } 109 }
99 } 110 }
100 111
101 virtual void SignalRemainingAncestor(ResourceType parentType, 112 virtual void SignalRemainingAncestor(ResourceType parentType,
102 const std::string& publicId) 113 const std::string& publicId)
120 } 131 }
121 132
122 virtual void SignalFileDeleted(const FileInfo& info) 133 virtual void SignalFileDeleted(const FileInfo& info)
123 { 134 {
124 assert(Toolbox::IsUuid(info.GetUuid())); 135 assert(Toolbox::IsUuid(info.GetUuid()));
125 pendingFilesToRemove_.push_back(info.GetUuid()); 136 pendingFilesToRemove_.push_back(FileToRemove(info));
126 sizeOfFilesToRemove_ += info.GetCompressedSize(); 137 sizeOfFilesToRemove_ += info.GetCompressedSize();
127 } 138 }
128 139
129 bool HasRemainingLevel() const 140 bool HasRemainingLevel() const
130 { 141 {