Mercurial > hg > orthanc
diff OrthancServer/Sources/ServerIndex.h @ 4577:a114a5db2afe db-changes
end of refactoring read-write transactions
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 09 Mar 2021 11:52:07 +0100 |
parents | 855e43bb293c |
children | 710748828b6a |
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerIndex.h Mon Mar 08 18:42:13 2021 +0100 +++ b/OrthancServer/Sources/ServerIndex.h Tue Mar 09 11:52:07 2021 +0100 @@ -61,7 +61,7 @@ class MainDicomTagsRegistry; bool done_; - boost::mutex mutex_; + boost::mutex monitoringMutex_; boost::thread flushThread_; boost::thread unstableResourcesMonitorThread_; @@ -85,12 +85,8 @@ int64_t resourceId, ResourceType resourceType); - bool IsRecyclingNeeded(uint64_t instanceSize); - - void Recycle(uint64_t instanceSize, - const std::string& newPatientId); - - void StandaloneRecycling(); + void StandaloneRecycling(uint64_t maximumStorageSize, + unsigned int maximumPatientCount); void MarkAsUnstable(int64_t id, Orthanc::ResourceType type, @@ -105,11 +101,6 @@ const DatabaseLookup& source, ResourceType level) const; - // A transaction must be running - static SeriesStatus GetSeriesStatus(IDatabaseWrapper& db, - int64_t id, - int64_t expectedNumberOfInstances); - bool IsUnstableResource(int64_t id); public: @@ -121,38 +112,14 @@ void Stop(); - uint64_t GetMaximumStorageSize() const - { - return maximumStorageSize_; - } - - uint64_t GetMaximumPatientCount() const - { - return maximumPatients_; - } - // "size == 0" means no limit on the storage size void SetMaximumStorageSize(uint64_t size); // "count == 0" means no limit on the number of patients void SetMaximumPatientCount(unsigned int count); - StoreStatus Store(std::map<MetadataType, std::string>& instanceMetadata, - const DicomMap& dicomSummary, - const Attachments& attachments, - const MetadataMap& metadata, - const DicomInstanceOrigin& origin, - bool overwrite, - bool hasTransferSyntax, - DicomTransferSyntax transferSyntax, - bool hasPixelDataOffset, - uint64_t pixelDataOffset); - StoreStatus AddAttachment(const FileInfo& attachment, - const std::string& publicId); - - - + /*** ** PROTOTYPING FOR DB REFACTORING BELOW ***/ @@ -174,10 +141,7 @@ **/ SeriesStatus GetSeriesStatus(int64_t id, - int64_t expectedNumberOfInstances) - { - return ServerIndex::GetSeriesStatus(db_, id, expectedNumberOfInstances); - } + int64_t expectedNumberOfInstances); void MainDicomTagsToJson(Json::Value& result, int64_t resourceId, @@ -373,6 +337,12 @@ return listener_; } + void AddAttachment(int64_t id, + const FileInfo& attachment) + { + db_.AddAttachment(id, attachment); + } + void ClearChanges() { db_.ClearChanges(); @@ -388,6 +358,16 @@ return db_.ClearMainDicomTags(id); } + bool CreateInstance(IDatabaseWrapper::CreateInstanceResult& result, /* out */ + int64_t& instanceId, /* out */ + const std::string& patient, + const std::string& study, + const std::string& series, + const std::string& instance) + { + return db_.CreateInstance(result, instanceId, patient, study, series, instance); + } + void DeleteAttachment(int64_t id, FileContentType attachment) { @@ -441,6 +421,11 @@ { db_.SetResourcesContent(content); } + + void Recycle(uint64_t maximumStorageSize, + unsigned int maximumPatients, + uint64_t addedInstanceSize, + const std::string& newPatientId); }; @@ -613,5 +598,19 @@ const std::string& publicId); void ReconstructInstance(const ParsedDicomFile& dicom); + + StoreStatus Store(std::map<MetadataType, std::string>& instanceMetadata, + const DicomMap& dicomSummary, + const Attachments& attachments, + const MetadataMap& metadata, + const DicomInstanceOrigin& origin, + bool overwrite, + bool hasTransferSyntax, + DicomTransferSyntax transferSyntax, + bool hasPixelDataOffset, + uint64_t pixelDataOffset); + + StoreStatus AddAttachment(const FileInfo& attachment, + const std::string& publicId); }; }