# HG changeset patch # User Sebastien Jodogne # Date 1607015747 -3600 # Node ID 977c2759eb0a8365c23967f79786f5d5eb083c18 # Parent 6fa8bb987be21b171a256819366507919547a2e6 Archive/media jobs report the size of the created ZIP file in content field "ArchiveSizeMB" diff -r 6fa8bb987be2 -r 977c2759eb0a NEWS --- a/NEWS Thu Dec 03 15:58:52 2020 +0100 +++ b/NEWS Thu Dec 03 18:15:47 2020 +0100 @@ -19,6 +19,7 @@ * "/modalities/{id}/configuration": Get the configuration of one modality (cf. "/modalities?expand") * "/tools/dicom-echo" and "/modalities/{id}/echo" now accept the field "CheckFind" in their JSON body to complement C-GET SCU with C-FIND SCU ("DicomEchoChecksFind" on a per-connection basis) +* Archive/media jobs report the size of the created ZIP file in content field "ArchiveSizeMB" Maintenance ----------- diff -r 6fa8bb987be2 -r 977c2759eb0a OrthancServer/Sources/ServerJobs/ArchiveJob.cpp --- a/OrthancServer/Sources/ServerJobs/ArchiveJob.cpp Thu Dec 03 15:58:52 2020 +0100 +++ b/OrthancServer/Sources/ServerJobs/ArchiveJob.cpp Thu Dec 03 18:15:47 2020 +0100 @@ -56,6 +56,7 @@ static const char* const KEY_DESCRIPTION = "Description"; static const char* const KEY_INSTANCES_COUNT = "InstancesCount"; static const char* const KEY_UNCOMPRESSED_SIZE_MB = "UncompressedSizeMB"; +static const char* const KEY_ARCHIVE_SIZE_MB = "ArchiveSizeMB"; static const char* const KEY_TRANSCODE = "Transcode"; @@ -851,6 +852,7 @@ currentStep_(0), instancesCount_(0), uncompressedSize_(0), + archiveSize_(0), transcode_(false), transferSyntax_(DicomTransferSyntax_LittleEndianImplicit) { @@ -993,10 +995,26 @@ } + void ArchiveJob::RefreshArchiveSize() + { + if (synchronousTarget_.get() != NULL) + { + archiveSize_ = synchronousTarget_->GetFileSize(); + } + + if (asynchronousTarget_.get() != NULL) + { + archiveSize_ = asynchronousTarget_->GetFileSize(); + } + } + + void ArchiveJob::FinalizeTarget() { writer_.reset(); // Flush all the results + RefreshArchiveSize(); + if (asynchronousTarget_.get() != NULL) { // Asynchronous behavior: Move the resulting file into the media archive @@ -1017,7 +1035,7 @@ return JobStepResult::Failure(ErrorCode_NetworkProtocol, "A client has disconnected while creating an archive"); } - + if (writer_->GetStepsCount() == 0) { FinalizeTarget(); @@ -1036,6 +1054,7 @@ } else { + RefreshArchiveSize(); return JobStepResult::Continue(); } } @@ -1077,6 +1096,8 @@ value[KEY_INSTANCES_COUNT] = instancesCount_; value[KEY_UNCOMPRESSED_SIZE_MB] = static_cast(uncompressedSize_ / MEGA_BYTES); + value[KEY_ARCHIVE_SIZE_MB] = + static_cast(archiveSize_ / MEGA_BYTES); if (transcode_) { diff -r 6fa8bb987be2 -r 977c2759eb0a OrthancServer/Sources/ServerJobs/ArchiveJob.h --- a/OrthancServer/Sources/ServerJobs/ArchiveJob.h Thu Dec 03 15:58:52 2020 +0100 +++ b/OrthancServer/Sources/ServerJobs/ArchiveJob.h Thu Dec 03 18:15:47 2020 +0100 @@ -67,11 +67,14 @@ size_t currentStep_; unsigned int instancesCount_; uint64_t uncompressedSize_; + uint64_t archiveSize_; std::string mediaArchiveId_; // New in Orthanc 1.7.0 bool transcode_; DicomTransferSyntax transferSyntax_; + + void RefreshArchiveSize(); void FinalizeTarget();