Mercurial > hg > orthanc
comparison OrthancServer/ServerIndex.cpp @ 224:4eb0c7ce86c9
refactoring for store
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 29 Nov 2012 22:22:00 +0100 |
parents | bb8c260c0092 |
children | 8a26a8e85edf |
comparison
equal
deleted
inserted
replaced
223:6f0e4a8ebb0f | 224:4eb0c7ce86c9 |
---|---|
348 | 348 |
349 return StoreStatus_Failure; | 349 return StoreStatus_Failure; |
350 } | 350 } |
351 | 351 |
352 | 352 |
353 StoreStatus ServerIndex::Store(FileStorage& storage, | |
354 const char* dicomFile, | |
355 size_t dicomSize, | |
356 const DicomMap& dicomSummary, | |
357 const Json::Value& dicomJson, | |
358 const std::string& remoteAet) | |
359 { | |
360 std::string fileUuid = storage.Create(dicomFile, dicomSize); | |
361 std::string jsonUuid = storage.Create(dicomJson.toStyledString()); | |
362 StoreStatus status = Store(dicomSummary, fileUuid, dicomSize, jsonUuid, remoteAet); | |
363 | |
364 if (status != StoreStatus_Success) | |
365 { | |
366 storage.Remove(fileUuid); | |
367 storage.Remove(jsonUuid); | |
368 } | |
369 | |
370 switch (status) | |
371 { | |
372 case StoreStatus_Success: | |
373 LOG(INFO) << "New instance stored"; | |
374 break; | |
375 | |
376 case StoreStatus_AlreadyStored: | |
377 LOG(INFO) << "Already stored"; | |
378 break; | |
379 | |
380 case StoreStatus_Failure: | |
381 LOG(ERROR) << "Store failure"; | |
382 break; | |
383 } | |
384 | |
385 return status; | |
386 } | |
387 | |
388 uint64_t ServerIndex::GetTotalCompressedSize() | 353 uint64_t ServerIndex::GetTotalCompressedSize() |
389 { | 354 { |
390 boost::mutex::scoped_lock lock(mutex_); | 355 boost::mutex::scoped_lock lock(mutex_); |
391 return db_->GetTotalCompressedSize(); | 356 return db_->GetTotalCompressedSize(); |
392 } | 357 } |