linkahead/file_transmission/download_request_handler.h

namespace linkahead
namespace transaction

Creation and execution of transactions.

Author

Timm Fitschen

Date

2021-08-05

class DownloadRequestHandler : public linkahead::transaction::HandlerInterface

Public Functions

DownloadRequestHandler(HandlerTag tag, FileTransmissionService::Stub *stub, grpc::CompletionQueue *cq, FileDescriptor file_descriptor)
~DownloadRequestHandler() override = default
DownloadRequestHandler(const DownloadRequestHandler&) = delete
DownloadRequestHandler &operator=(const DownloadRequestHandler&) = delete
DownloadRequestHandler(DownloadRequestHandler&&) = delete
DownloadRequestHandler &operator=(DownloadRequestHandler&&) = delete
inline virtual void Start() override
virtual bool OnNext(bool ok) override
virtual void Cancel() override

Protected Types

enum CallState

Values:

enumerator NewCall
enumerator SendingRequest
enumerator ReceivingFile
enumerator CallComplete

Protected Functions

void handleNewCallState()
void handleSendingRequestState()
void handleReceivingFileState()
void handleCallCompleteState()

Protected Attributes

HandlerTag tag_
FileTransmissionService::Stub *stub_
grpc::CompletionQueue *cq_
grpc::ClientContext ctx_
std::unique_ptr<grpc::ClientAsyncReader<FileDownloadResponse>> rpc_
FileDownloadRequest *request_
FileDownloadResponse *response_
grpc::Status status_
CallState state_
std::unique_ptr<FileWriter> fileWriter_
FileDescriptor file_descriptor_
uint64_t bytesReceived_