comparison OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp @ 5553:28cc06e4859a large-queries

Added ExtendedApiV1: /changes
author Alain Mazy <am@orthanc.team>
date Thu, 11 Apr 2024 19:02:20 +0200
parents 9a431368801b
children 3765085693e5
comparison
equal deleted inserted replaced
5549:dcbf0c776945 5553:28cc06e4859a
1216 } 1216 }
1217 }; 1217 };
1218 1218
1219 Operations operations; 1219 Operations operations;
1220 operations.Apply(*this, target, since, maxResults); 1220 operations.Apply(*this, target, since, maxResults);
1221 }
1222
1223
1224 void StatelessDatabaseOperations::GetChanges2(Json::Value& target,
1225 int64_t since,
1226 int64_t to,
1227 unsigned int maxResults,
1228 ChangeType changeType)
1229 {
1230 class Operations : public ReadOnlyOperationsT5<Json::Value&, int64_t, int64_t, unsigned int, unsigned int>
1231 {
1232 public:
1233 virtual void ApplyTuple(ReadOnlyTransaction& transaction,
1234 const Tuple& tuple) ORTHANC_OVERRIDE
1235 {
1236 std::list<ServerIndexChange> changes;
1237 bool done;
1238 bool hasLast = false;
1239 int64_t last = 0;
1240
1241 transaction.GetChanges2(changes, done, tuple.get<1>(), tuple.get<2>(), tuple.get<3>(), static_cast<ChangeType>(tuple.get<4>()));
1242 if (changes.empty())
1243 {
1244 last = transaction.GetLastChangeIndex();
1245 hasLast = true;
1246 }
1247
1248 FormatLog(tuple.get<0>(), changes, "Changes", done, tuple.get<1>(), hasLast, last);
1249 }
1250 };
1251
1252 Operations operations;
1253 operations.Apply(*this, target, since, to, maxResults, changeType);
1221 } 1254 }
1222 1255
1223 1256
1224 void StatelessDatabaseOperations::GetLastChange(Json::Value& target) 1257 void StatelessDatabaseOperations::GetLastChange(Json::Value& target)
1225 { 1258 {
3773 bool StatelessDatabaseOperations::HasLabelsSupport() 3806 bool StatelessDatabaseOperations::HasLabelsSupport()
3774 { 3807 {
3775 boost::shared_lock<boost::shared_mutex> lock(mutex_); 3808 boost::shared_lock<boost::shared_mutex> lock(mutex_);
3776 return db_.GetDatabaseCapabilities().HasLabelsSupport(); 3809 return db_.GetDatabaseCapabilities().HasLabelsSupport();
3777 } 3810 }
3811
3812 bool StatelessDatabaseOperations::HasExtendedApiV1()
3813 {
3814 boost::shared_lock<boost::shared_mutex> lock(mutex_);
3815 return db_.GetDatabaseCapabilities().HasExtendedApiV1();
3816 }
3778 } 3817 }