comparison OrthancServer/ServerJobs/ArchiveJob.cpp @ 2965:9c0b0a6d8b54

MediaArchiveSize configuration option
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 05 Dec 2018 14:33:47 +0100
parents bbfd95a0c429
children 10c610e80b15
comparison
equal deleted inserted replaced
2964:6896a7c1cbe2 2965:9c0b0a6d8b54
776 return commands_.GetUncompressedSize(); 776 return commands_.GetUncompressedSize();
777 } 777 }
778 }; 778 };
779 779
780 780
781 ArchiveJob::ArchiveJob(boost::shared_ptr<TemporaryFile>& target, 781 ArchiveJob::ArchiveJob(boost::shared_ptr<TemporaryFile>& synchronousTarget,
782 ServerContext& context, 782 ServerContext& context,
783 bool isMedia, 783 bool isMedia,
784 bool enableExtendedSopClass) : 784 bool enableExtendedSopClass) :
785 target_(target), 785 synchronousTarget_(synchronousTarget),
786 context_(context), 786 context_(context),
787 archive_(new ArchiveIndex(ResourceType_Patient)), // root 787 archive_(new ArchiveIndex(ResourceType_Patient)), // root
788 isMedia_(isMedia), 788 isMedia_(isMedia),
789 enableExtendedSopClass_(enableExtendedSopClass), 789 enableExtendedSopClass_(enableExtendedSopClass),
790 currentStep_(0), 790 currentStep_(0),
791 instancesCount_(0), 791 instancesCount_(0),
792 uncompressedSize_(0) 792 uncompressedSize_(0)
793 { 793 {
794 if (target.get() == NULL) 794 if (synchronousTarget.get() == NULL)
795 { 795 {
796 throw OrthancException(ErrorCode_NullPointer); 796 throw OrthancException(ErrorCode_NullPointer);
797 } 797 }
798 } 798 }
799 799
822 if (writer_.get() != NULL) 822 if (writer_.get() != NULL)
823 { 823 {
824 throw OrthancException(ErrorCode_BadSequenceOfCalls); 824 throw OrthancException(ErrorCode_BadSequenceOfCalls);
825 } 825 }
826 826
827 writer_.reset(new ZipWriterIterator(*target_, context_, *archive_, 827 writer_.reset(new ZipWriterIterator(*synchronousTarget_, context_, *archive_,
828 isMedia_, enableExtendedSopClass_)); 828 isMedia_, enableExtendedSopClass_));
829 829
830 instancesCount_ = writer_->GetInstancesCount(); 830 instancesCount_ = writer_->GetInstancesCount();
831 uncompressedSize_ = writer_->GetUncompressedSize(); 831 uncompressedSize_ = writer_->GetUncompressedSize();
832 } 832 }
834 834
835 JobStepResult ArchiveJob::Step() 835 JobStepResult ArchiveJob::Step()
836 { 836 {
837 assert(writer_.get() != NULL); 837 assert(writer_.get() != NULL);
838 838
839 if (target_.unique()) 839 if (synchronousTarget_.unique())
840 { 840 {
841 LOG(WARNING) << "A client has disconnected while creating an archive"; 841 LOG(WARNING) << "A client has disconnected while creating an archive";
842 return JobStepResult::Failure(ErrorCode_NetworkProtocol); 842 return JobStepResult::Failure(ErrorCode_NetworkProtocol);
843 } 843 }
844 844