6#include "azure/storage/common/dll_import_export.hpp"
8#include <azure/core/context.hpp>
9#include <azure/core/io/body_stream.hpp>
15namespace Azure {
namespace Storage {
namespace _internal {
17 AZ_STORAGE_COMMON_DLLEXPORT
extern const Azure::Core::Context::Key
18 ReliableStreamClientRequestIdKey;
21 struct ReliableStreamOptions final
24 int32_t MaxRetryRequests;
39 class ReliableStream final :
public Azure::Core::IO::BodyStream {
42 std::unique_ptr<Azure::Core::IO::BodyStream> m_inner;
44 ReliableStreamOptions
const m_options;
47 std::unique_ptr<Azure::Core::IO::BodyStream>(int64_t, Azure::Core::Context
const&)>
50 int64_t m_retryOffset;
52 size_t OnRead(uint8_t* buffer,
size_t count, Azure::Core::Context
const& context)
override;
55 explicit ReliableStream(
56 std::unique_ptr<Azure::Core::IO::BodyStream> inner,
57 ReliableStreamOptions
const options,
59 std::unique_ptr<Azure::Core::IO::BodyStream>(int64_t, Azure::Core::Context
const&)>
61 : m_inner(std::move(inner)), m_options(options),
62 m_streamReconnector(std::move(streamReconnector)), m_retryOffset(0)
66 int64_t Length()
const override {
return this->m_inner->Length(); }
67 void Rewind()
override
70 this->m_inner->Rewind();
71 this->m_retryOffset = 0;