Audacity 3.2.0
|
#include <MissingBlocksUploader.h>
Classes | |
struct | ProducedItem |
struct | Tag |
Public Member Functions | |
MissingBlocksUploader (Tag, const ServiceConfig &serviceConfig) | |
~MissingBlocksUploader () | |
Public Member Functions inherited from audacity::concurrency::ICancellable | |
virtual | ~ICancellable ()=default |
virtual void | Cancel ()=0 |
Static Public Member Functions | |
static std::shared_ptr< MissingBlocksUploader > | Create (CancellationContextPtr cancellationContex, const ServiceConfig &serviceConfig, std::vector< BlockUploadTask > uploadTasks, MissingBlocksUploadProgressCallback progress) |
Static Public Attributes | |
static constexpr auto | NUM_PRODUCERS = 3 |
static constexpr auto | NUM_UPLOADERS = 6 |
static constexpr auto | RING_BUFFER_SIZE = 16 |
Private Member Functions | |
void | Start (CancellationContextPtr cancellationContex, std::vector< BlockUploadTask > uploadTasks, MissingBlocksUploadProgressCallback progress) |
void | Cancel () override |
ProducedItem | ProduceBlock () |
void | ConsumeBlock (ProducedItem item) |
void | PushBlockToQueue (ProducedItem item) |
ProducedItem | PopBlockFromQueue () |
void | ConfirmBlock (BlockUploadTask task) |
void | HandleFailedBlock (const ResponseResult &result, BlockUploadTask task) |
void | ProducerThread () |
void | ConsumerThread () |
Private Attributes | |
const ServiceConfig & | mServiceConfig |
std::vector< BlockUploadTask > | mUploadTasks |
MissingBlocksUploadProgressCallback | mProgressCallback |
std::atomic_bool | mIsRunning { true } |
std::thread | mProducerThread [NUM_PRODUCERS] |
std::thread | mConsumerThread |
std::mutex | mBlocksMutex |
size_t | mFirstUnprocessedBlockIndex { 0 } |
std::mutex | mUploadsMutex |
std::condition_variable | mUploadsNotFull |
size_t | mConcurrentUploads { 0 } |
std::mutex | mRingBufferMutex |
std::condition_variable | mRingBufferNotEmpty |
std::condition_variable | mRingBufferNotFull |
std::array< ProducedItem, RING_BUFFER_SIZE > | mRingBuffer |
size_t | mRingBufferWriteIndex { 0 } |
size_t | mRingBufferReadIndex { 0 } |
std::mutex | mProgressDataMutex |
MissingBlocksUploadProgress | mProgressData |
CancellationContextPtr | mCancellationContext |
Definition at line 63 of file MissingBlocksUploader.h.
audacity::cloud::audiocom::sync::MissingBlocksUploader::MissingBlocksUploader | ( | Tag | , |
const ServiceConfig & | serviceConfig | ||
) |
Definition at line 21 of file MissingBlocksUploader.cpp.
audacity::cloud::audiocom::sync::MissingBlocksUploader::~MissingBlocksUploader | ( | ) |
Definition at line 47 of file MissingBlocksUploader.cpp.
References Cancel().
|
overrideprivatevirtual |
Implements audacity::concurrency::ICancellable.
Definition at line 71 of file MissingBlocksUploader.cpp.
References mConsumerThread, mIsRunning, mProducerThread, mProgressDataMutex, mRingBufferNotEmpty, mRingBufferNotFull, and mUploadsNotFull.
Referenced by ~MissingBlocksUploader().
|
private |
Definition at line 175 of file MissingBlocksUploader.cpp.
References audacity::cloud::audiocom::sync::BlockUploadTask::Block, mConcurrentUploads, mProgressCallback, mProgressData, mProgressDataMutex, mUploadsMutex, mUploadsNotFull, and audacity::cloud::audiocom::sync::MissingBlocksUploadProgress::UploadedBlocks.
Referenced by ConsumeBlock().
|
private |
Definition at line 96 of file MissingBlocksUploader.cpp.
References audacity::cloud::audiocom::sync::BlockUploadTask::BlockUrls, audacity::cloud::audiocom::ResponseResult::Code, audacity::cloud::audiocom::sync::MissingBlocksUploader::ProducedItem::CompressedData, ConfirmBlock(), audacity::cloud::audiocom::sync::DataUploader::Get(), HandleFailedBlock(), mCancellationContext, mConcurrentUploads, mIsRunning, mServiceConfig, mUploadsMutex, mUploadsNotFull, NUM_UPLOADERS, audacity::cloud::audiocom::Success, audacity::cloud::audiocom::sync::MissingBlocksUploader::ProducedItem::Task, and audacity::cloud::audiocom::sync::DataUploader::Upload().
|
private |
Definition at line 255 of file MissingBlocksUploader.cpp.
Referenced by Start().
|
static |
Definition at line 27 of file MissingBlocksUploader.cpp.
References audacity::concurrency::CancellationContext::Create().
Referenced by audacity::cloud::audiocom::sync::LocalProjectSnapshot::OnSnapshotCreated(), and audacity::cloud::audiocom::sync::anonymous_namespace{ResumedSnaphotUploadOperation.cpp}::ResumedSnaphotUploadOperation::UploadBlocks().
|
private |
Definition at line 193 of file MissingBlocksUploader.cpp.
References audacity::cloud::audiocom::sync::BlockUploadTask::Block, audacity::cloud::audiocom::sync::MissingBlocksUploadProgress::FailedBlocks, mCancellationContext, mConcurrentUploads, mProgressCallback, mProgressData, mProgressDataMutex, mUploadsMutex, mUploadsNotFull, and audacity::cloud::audiocom::sync::MissingBlocksUploadProgress::UploadErrors.
Referenced by ConsumeBlock().
|
private |
Definition at line 153 of file MissingBlocksUploader.cpp.
References mIsRunning, mRingBuffer, mRingBufferMutex, mRingBufferNotEmpty, mRingBufferNotFull, mRingBufferReadIndex, mRingBufferWriteIndex, and RING_BUFFER_SIZE.
|
private |
Definition at line 88 of file MissingBlocksUploader.cpp.
References audacity::cloud::audiocom::sync::CompressBlock(), mFirstUnprocessedBlockIndex, and mUploadTasks.
|
private |
Definition at line 216 of file MissingBlocksUploader.cpp.
References audacity::cloud::audiocom::sync::BlockUploadTask::Block, audacity::cloud::audiocom::sync::CompressBlock(), audacity::cloud::audiocom::sync::MissingBlocksUploadProgress::FailedBlocks, mBlocksMutex, mFirstUnprocessedBlockIndex, mIsRunning, mProgressCallback, mProgressData, mProgressDataMutex, mUploadTasks, and PushBlockToQueue().
Referenced by Start().
|
private |
Definition at line 132 of file MissingBlocksUploader.cpp.
References mIsRunning, mRingBuffer, mRingBufferMutex, mRingBufferNotEmpty, mRingBufferNotFull, mRingBufferReadIndex, mRingBufferWriteIndex, and RING_BUFFER_SIZE.
Referenced by ProducerThread().
|
private |
Definition at line 52 of file MissingBlocksUploader.cpp.
References ConsumerThread(), mCancellationContext, mConsumerThread, mProducerThread, mProgressCallback, mProgressData, mUploadTasks, ProducerThread(), and audacity::cloud::audiocom::sync::MissingBlocksUploadProgress::TotalBlocks.
|
private |
Definition at line 121 of file MissingBlocksUploader.h.
Referenced by ProducerThread().
|
private |
Definition at line 140 of file MissingBlocksUploader.h.
Referenced by ConsumeBlock(), HandleFailedBlock(), and Start().
|
private |
Definition at line 126 of file MissingBlocksUploader.h.
Referenced by ConfirmBlock(), ConsumeBlock(), and HandleFailedBlock().
|
private |
Definition at line 119 of file MissingBlocksUploader.h.
|
private |
Definition at line 122 of file MissingBlocksUploader.h.
Referenced by ProduceBlock(), and ProducerThread().
|
private |
Definition at line 116 of file MissingBlocksUploader.h.
Referenced by Cancel(), ConsumeBlock(), PopBlockFromQueue(), ProducerThread(), and PushBlockToQueue().
|
private |
Definition at line 118 of file MissingBlocksUploader.h.
|
private |
Definition at line 114 of file MissingBlocksUploader.h.
Referenced by ConfirmBlock(), HandleFailedBlock(), ProducerThread(), and Start().
|
private |
Definition at line 138 of file MissingBlocksUploader.h.
Referenced by ConfirmBlock(), HandleFailedBlock(), ProducerThread(), and Start().
|
private |
Definition at line 137 of file MissingBlocksUploader.h.
Referenced by Cancel(), ConfirmBlock(), HandleFailedBlock(), and ProducerThread().
|
private |
Definition at line 133 of file MissingBlocksUploader.h.
Referenced by PopBlockFromQueue(), and PushBlockToQueue().
|
private |
Definition at line 128 of file MissingBlocksUploader.h.
Referenced by PopBlockFromQueue(), and PushBlockToQueue().
|
private |
Definition at line 130 of file MissingBlocksUploader.h.
Referenced by Cancel(), PopBlockFromQueue(), and PushBlockToQueue().
|
private |
Definition at line 131 of file MissingBlocksUploader.h.
Referenced by Cancel(), PopBlockFromQueue(), and PushBlockToQueue().
|
private |
Definition at line 135 of file MissingBlocksUploader.h.
Referenced by PopBlockFromQueue(), and PushBlockToQueue().
|
private |
Definition at line 134 of file MissingBlocksUploader.h.
Referenced by PopBlockFromQueue(), and PushBlockToQueue().
|
private |
Definition at line 111 of file MissingBlocksUploader.h.
Referenced by ConsumeBlock().
|
private |
Definition at line 124 of file MissingBlocksUploader.h.
Referenced by ConfirmBlock(), ConsumeBlock(), and HandleFailedBlock().
|
private |
Definition at line 125 of file MissingBlocksUploader.h.
Referenced by Cancel(), ConfirmBlock(), ConsumeBlock(), and HandleFailedBlock().
|
private |
Definition at line 113 of file MissingBlocksUploader.h.
Referenced by ProduceBlock(), ProducerThread(), and Start().
|
staticconstexpr |
Definition at line 72 of file MissingBlocksUploader.h.
|
staticconstexpr |
Definition at line 73 of file MissingBlocksUploader.h.
Referenced by ConsumeBlock().
|
staticconstexpr |
Definition at line 74 of file MissingBlocksUploader.h.
Referenced by PopBlockFromQueue(), and PushBlockToQueue().