Mercurial > hg > orthanc
comparison OrthancServer/ServerIndex.cpp @ 1189:6b9b02a16e99 db-changes
NewChildInstance change type
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 25 Sep 2014 17:02:28 +0200 |
parents | 5b2d8c280ac2 |
children | d49505e377e3 |
comparison
equal
deleted
inserted
replaced
1187:49edef619f1f | 1189:6b9b02a16e99 |
---|---|
136 void Reset() | 136 void Reset() |
137 { | 137 { |
138 sizeOfFilesToRemove_ = 0; | 138 sizeOfFilesToRemove_ = 0; |
139 hasRemainingLevel_ = false; | 139 hasRemainingLevel_ = false; |
140 pendingFilesToRemove_.clear(); | 140 pendingFilesToRemove_.clear(); |
141 pendingChanges_.clear(); | |
141 } | 142 } |
142 | 143 |
143 uint64_t GetSizeOfFilesToRemove() | 144 uint64_t GetSizeOfFilesToRemove() |
144 { | 145 { |
145 return sizeOfFilesToRemove_; | 146 return sizeOfFilesToRemove_; |
146 } | 147 } |
147 | 148 |
148 void CommitFilesToRemove() | 149 void CommitFilesToRemove() |
149 { | 150 { |
150 for (std::list<FileToRemove>::iterator | 151 for (std::list<FileToRemove>::const_iterator |
151 it = pendingFilesToRemove_.begin(); | 152 it = pendingFilesToRemove_.begin(); |
152 it != pendingFilesToRemove_.end(); ++it) | 153 it != pendingFilesToRemove_.end(); ++it) |
153 { | 154 { |
154 context_.RemoveFile(it->GetUuid(), it->GetContentType()); | 155 context_.RemoveFile(it->GetUuid(), it->GetContentType()); |
156 } | |
157 } | |
158 | |
159 void CommitChanges() | |
160 { | |
161 for (std::list<Change>::const_iterator | |
162 it = pendingChanges_.begin(); | |
163 it != pendingChanges_.end(); it++) | |
164 { | |
165 context_.SignalChange(it->GetChangeType(), it->GetResourceType(), it->GetPublicId()); | |
155 } | 166 } |
156 } | 167 } |
157 | 168 |
158 virtual void SignalRemainingAncestor(ResourceType parentType, | 169 virtual void SignalRemainingAncestor(ResourceType parentType, |
159 const std::string& publicId) | 170 const std::string& publicId) |
247 | 258 |
248 assert(index_.currentStorageSize_ >= index_.listener_->GetSizeOfFilesToRemove()); | 259 assert(index_.currentStorageSize_ >= index_.listener_->GetSizeOfFilesToRemove()); |
249 index_.currentStorageSize_ -= index_.listener_->GetSizeOfFilesToRemove(); | 260 index_.currentStorageSize_ -= index_.listener_->GetSizeOfFilesToRemove(); |
250 | 261 |
251 assert(index_.currentStorageSize_ == index_.db_->GetTotalCompressedSize()); | 262 assert(index_.currentStorageSize_ == index_.db_->GetTotalCompressedSize()); |
263 | |
264 // Send all the pending changes to the Orthanc plugins | |
265 index_.listener_->CommitChanges(); | |
252 | 266 |
253 isCommitted_ = true; | 267 isCommitted_ = true; |
254 } | 268 } |
255 } | 269 } |
256 }; | 270 }; |
1693 type == Orthanc::ResourceType_Series); | 1707 type == Orthanc::ResourceType_Series); |
1694 | 1708 |
1695 UnstableResourcePayload payload(type, publicId); | 1709 UnstableResourcePayload payload(type, publicId); |
1696 unstableResources_.AddOrMakeMostRecent(id, payload); | 1710 unstableResources_.AddOrMakeMostRecent(id, payload); |
1697 //LOG(INFO) << "Unstable resource: " << EnumerationToString(type) << " " << id; | 1711 //LOG(INFO) << "Unstable resource: " << EnumerationToString(type) << " " << id; |
1712 | |
1713 db_->LogChange(ChangeType_NewChildInstance, id, type, publicId); | |
1698 } | 1714 } |
1699 | 1715 |
1700 | 1716 |
1701 | 1717 |
1702 void ServerIndex::LookupIdentifier(std::list<std::string>& result, | 1718 void ServerIndex::LookupIdentifier(std::list<std::string>& result, |