6#include "azure/storage/common/dll_import_export.hpp"
8#include <azure/core/http/policies/policy.hpp>
13namespace Azure {
namespace Storage {
namespace _internal {
15 AZ_STORAGE_COMMON_DLLEXPORT
extern const Azure::Core::Context::Key SecondaryHostReplicaStatusKey;
17 inline Azure::Core::Context WithReplicaStatus(
const Azure::Core::Context& context)
19 return context.WithValue(SecondaryHostReplicaStatusKey, std::make_shared<bool>(
true));
22 class StorageSwitchToSecondaryPolicy final :
public Azure::Core::Http::Policies::HttpPolicy {
24 explicit StorageSwitchToSecondaryPolicy(std::string primaryHost, std::string secondaryHost)
25 : m_primaryHost(std::move(primaryHost)), m_secondaryHost(std::move(secondaryHost))
29 std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy> Clone()
const override
31 return std::make_unique<StorageSwitchToSecondaryPolicy>(*
this);
34 std::unique_ptr<Azure::Core::Http::RawResponse> Send(
35 Azure::Core::Http::Request& request,
36 Azure::Core::Http::Policies::NextHttpPolicy nextPolicy,
37 const Azure::Core::Context& context)
const override;
40 std::string m_primaryHost;
41 std::string m_secondaryHost;