annotate Framework/PushMode/ActivePushTransactions.cpp @ 37:9708addb5a87

added 'Resources' and 'Originator' in the jobs 'Content'
author Alain Mazy <am@osimis.io>
date Wed, 08 Jun 2022 17:11:13 +0200
parents 44a0430d7899
children 1e396fb509ca
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Transfers accelerator plugin for Orthanc
33
44a0430d7899 upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 25
diff changeset
3 * Copyright (C) 2018-2021 Osimis S.A., Belgium
0
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 *
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * modify it under the terms of the GNU Affero General Public License
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * as published by the Free Software Foundation, either version 3 of
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * the License, or (at your option) any later version.
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 *
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful, but
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * Affero General Public License for more details.
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 *
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU Affero General Public License
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 **/
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 #include "ActivePushTransactions.h"
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #include "../DownloadArea.h"
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
25
dfc43678aecb replacing deprecated std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 20
diff changeset
24 #include <Compatibility.h> // For std::unique_ptr
20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 19
diff changeset
25 #include <Logging.h>
0
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 namespace OrthancPlugins
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 {
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 class ActivePushTransactions::Transaction : public boost::noncopyable
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 {
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 private:
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 DownloadArea area_;
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 std::vector<TransferBucket> buckets_;
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 BucketCompression compression_;
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 public:
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 Transaction(const std::vector<DicomInstanceInfo>& instances,
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 const std::vector<TransferBucket>& buckets,
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 BucketCompression compression) :
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 area_(instances),
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 buckets_(buckets),
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 compression_(compression)
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 {
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 }
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 DownloadArea& GetDownloadArea()
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 {
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 return area_;
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 }
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 BucketCompression GetCompression() const
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 {
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 return compression_;
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 }
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 const TransferBucket& GetBucket(size_t index) const
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 {
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 if (index >= buckets_.size())
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 {
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 }
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 else
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 {
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 return buckets_[index];
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 }
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 }
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 void Store(size_t bucketIndex,
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 const void* data,
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 size_t size)
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 {
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 area_.WriteBucket(GetBucket(bucketIndex), data, size, compression_);
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 }
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 };
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77
8
4c3437217518 fix for compatibility with simplified OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
78 void ActivePushTransactions::FinalizeTransaction(const std::string& transactionUuid,
0
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 bool commit)
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 {
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 boost::mutex::scoped_lock lock(mutex_);
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 Content::iterator found = content_.find(transactionUuid);
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 if (found == content_.end())
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 {
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 throw Orthanc::OrthancException(Orthanc::ErrorCode_UnknownResource);
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 }
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 assert(found->second != NULL);
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 if (commit)
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 {
8
4c3437217518 fix for compatibility with simplified OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
92 found->second->GetDownloadArea().Commit();
0
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 }
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 delete found->second;
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 content_.erase(found);
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 index_.Invalidate(transactionUuid);
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 }
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 ActivePushTransactions::~ActivePushTransactions()
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 {
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 for (Content::iterator it = content_.begin(); it != content_.end(); ++it)
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 {
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 LOG(WARNING) << "Discarding an uncommitted push transaction "
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 << "in the transfers accelerator: " << it->first;
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 assert(it->second != NULL);
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 delete it->second;
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 }
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 }
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 void ActivePushTransactions::ListTransactions(std::vector<std::string>& target)
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 {
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 boost::mutex::scoped_lock lock(mutex_);
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 target.clear();
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 target.reserve(content_.size());
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 for (Content::const_iterator it = content_.begin();
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 it != content_.end(); ++it)
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 {
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 target.push_back(it->first);
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 }
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 }
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 std::string ActivePushTransactions::CreateTransaction(const std::vector<DicomInstanceInfo>& instances,
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 const std::vector<TransferBucket>& buckets,
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 BucketCompression compression)
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 {
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 std::string uuid = Orthanc::Toolbox::GenerateUuid();
25
dfc43678aecb replacing deprecated std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 20
diff changeset
134 std::unique_ptr<Transaction> tmp(new Transaction(instances, buckets, compression));
0
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 LOG(INFO) << "Creating transaction to receive " << instances.size()
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 << " instances (" << ConvertToMegabytes(tmp->GetDownloadArea().GetTotalSize())
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 << "MB) in push mode: " << uuid;
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 {
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 boost::mutex::scoped_lock lock(mutex_);
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 // Drop the oldest active transaction, if not enough place
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 if (content_.size() == maxSize_)
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 {
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 std::string oldest = index_.RemoveOldest();
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 Content::iterator transaction = content_.find(oldest);
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 assert(transaction != content_.end() &&
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 transaction->second != NULL);
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 delete transaction->second;
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 content_.erase(transaction);
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 LOG(WARNING) << "An inactive push transaction has been discarded: " << oldest;
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 }
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 index_.Add(uuid);
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 content_[uuid] = tmp.release();
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 }
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 return uuid;
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 }
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165
8
4c3437217518 fix for compatibility with simplified OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
166 void ActivePushTransactions::Store(const std::string& transactionUuid,
0
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 size_t bucketIndex,
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 const void* data,
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 size_t size)
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 {
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 boost::mutex::scoped_lock lock(mutex_);
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 Content::iterator found = content_.find(transactionUuid);
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 if (found == content_.end())
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 {
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 throw Orthanc::OrthancException(Orthanc::ErrorCode_UnknownResource);
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 }
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 assert(found->second != NULL);
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 index_.MakeMostRecent(transactionUuid);
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 found->second->Store(bucketIndex, data, size);
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 }
95226b754d9e initial release
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 }