comparison OrthancServer/ServerIndex.cpp @ 1196:669bb978d52e db-changes

rename
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 23 Oct 2014 13:18:26 +0200
parents d49505e377e3
children 1169528a9a5f
comparison
equal deleted inserted replaced
1191:d49505e377e3 1196:669bb978d52e
80 { 80 {
81 return type_; 81 return type_;
82 } 82 }
83 }; 83 };
84 84
85 struct Change 85 struct ServerIndexChange
86 { 86 {
87 private: 87 private:
88 ChangeType changeType_; 88 ChangeType changeType_;
89 ResourceType resourceType_; 89 ResourceType resourceType_;
90 std::string publicId_; 90 std::string publicId_;
91 91
92 public: 92 public:
93 Change(ChangeType changeType, 93 ServerIndexChange(ChangeType changeType,
94 ResourceType resourceType, 94 ResourceType resourceType,
95 const std::string& publicId) : 95 const std::string& publicId) :
96 changeType_(changeType), 96 changeType_(changeType),
97 resourceType_(resourceType), 97 resourceType_(resourceType),
98 publicId_(publicId) 98 publicId_(publicId)
118 ServerContext& context_; 118 ServerContext& context_;
119 bool hasRemainingLevel_; 119 bool hasRemainingLevel_;
120 ResourceType remainingType_; 120 ResourceType remainingType_;
121 std::string remainingPublicId_; 121 std::string remainingPublicId_;
122 std::list<FileToRemove> pendingFilesToRemove_; 122 std::list<FileToRemove> pendingFilesToRemove_;
123 std::list<Change> pendingChanges_; 123 std::list<ServerIndexChange> pendingChanges_;
124 uint64_t sizeOfFilesToRemove_; 124 uint64_t sizeOfFilesToRemove_;
125 bool insideTransaction_; 125 bool insideTransaction_;
126 126
127 void Reset() 127 void Reset()
128 { 128 {
168 } 168 }
169 } 169 }
170 170
171 void CommitChanges() 171 void CommitChanges()
172 { 172 {
173 for (std::list<Change>::const_iterator 173 for (std::list<ServerIndexChange>::const_iterator
174 it = pendingChanges_.begin(); 174 it = pendingChanges_.begin();
175 it != pendingChanges_.end(); it++) 175 it != pendingChanges_.end(); it++)
176 { 176 {
177 context_.SignalChange(it->GetChangeType(), it->GetResourceType(), it->GetPublicId()); 177 context_.SignalChange(it->GetChangeType(), it->GetResourceType(), it->GetPublicId());
178 } 178 }
213 LOG(INFO) << "Change related to resource " << publicId << " of type " 213 LOG(INFO) << "Change related to resource " << publicId << " of type "
214 << EnumerationToString(resourceType) << ": " << EnumerationToString(changeType); 214 << EnumerationToString(resourceType) << ": " << EnumerationToString(changeType);
215 215
216 if (insideTransaction_) 216 if (insideTransaction_)
217 { 217 {
218 pendingChanges_.push_back(Change(changeType, resourceType, publicId)); 218 pendingChanges_.push_back(ServerIndexChange(changeType, resourceType, publicId));
219 } 219 }
220 else 220 else
221 { 221 {
222 context_.SignalChange(changeType, resourceType, publicId); 222 context_.SignalChange(changeType, resourceType, publicId);
223 } 223 }