comparison OrthancServer/Sources/ServerIndex.cpp @ 4572:c12d4e5f469b db-changes

removed redundant ServerIndex::SignalNewResource()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 08 Mar 2021 17:08:10 +0100
parents 9224e107d613
children f6bd5563b5df
comparison
equal deleted inserted replaced
4571:9224e107d613 4572:c12d4e5f469b
681 content.AddMetadata(instance, metadata, value); 681 content.AddMetadata(instance, metadata, value);
682 instanceMetadata[metadata] = value; 682 instanceMetadata[metadata] = value;
683 } 683 }
684 684
685 685
686 void ServerIndex::SignalNewResource(ChangeType changeType,
687 ResourceType level,
688 const std::string& publicId,
689 int64_t internalId)
690 {
691 ServerIndexChange change(changeType, level, publicId);
692 db_.LogChange(internalId, change);
693
694 assert(listener_.get() != NULL);
695 listener_->SignalChange(change);
696 }
697
698
699 StoreStatus ServerIndex::Store(std::map<MetadataType, std::string>& instanceMetadata, 686 StoreStatus ServerIndex::Store(std::map<MetadataType, std::string>& instanceMetadata,
700 const DicomMap& dicomSummary, 687 const DicomMap& dicomSummary,
701 const Attachments& attachments, 688 const Attachments& attachments,
702 const MetadataMap& metadata, 689 const MetadataMap& metadata,
703 const DicomInstanceOrigin& origin, 690 const DicomInstanceOrigin& origin,
762 // NB: In theory, could be sped up by grouping the underlying 749 // NB: In theory, could be sped up by grouping the underlying
763 // calls to "db_.LogChange()". However, this would only have an 750 // calls to "db_.LogChange()". However, this would only have an
764 // impact when new patient/study/series get created, which 751 // impact when new patient/study/series get created, which
765 // occurs far less often that creating new instances. The 752 // occurs far less often that creating new instances. The
766 // positive impact looks marginal in practice. 753 // positive impact looks marginal in practice.
767 SignalNewResource(ChangeType_NewInstance, ResourceType_Instance, hashInstance, instanceId); 754 LogChange(instanceId, ChangeType_NewInstance, ResourceType_Instance, hashInstance);
768 755
769 if (status.isNewSeries_) 756 if (status.isNewSeries_)
770 { 757 {
771 SignalNewResource(ChangeType_NewSeries, ResourceType_Series, hashSeries, status.seriesId_); 758 LogChange(status.seriesId_, ChangeType_NewSeries, ResourceType_Series, hashSeries);
772 } 759 }
773 760
774 if (status.isNewStudy_) 761 if (status.isNewStudy_)
775 { 762 {
776 SignalNewResource(ChangeType_NewStudy, ResourceType_Study, hashStudy, status.studyId_); 763 LogChange(status.studyId_, ChangeType_NewStudy, ResourceType_Study, hashStudy);
777 } 764 }
778 765
779 if (status.isNewPatient_) 766 if (status.isNewPatient_)
780 { 767 {
781 SignalNewResource(ChangeType_NewPatient, ResourceType_Patient, hashPatient, status.patientId_); 768 LogChange(status.patientId_, ChangeType_NewPatient, ResourceType_Patient, hashPatient);
782 } 769 }
783 770
784 771
785 // Ensure there is enough room in the storage for the new instance 772 // Ensure there is enough room in the storage for the new instance
786 uint64_t instanceSize = 0; 773 uint64_t instanceSize = 0;