10USERVER_NAMESPACE_BEGIN
14class SubscribeSentinel;
17namespace storages::
redis {
21class SubscriptionTokenImplBase {
23 SubscriptionTokenImplBase() =
default;
25 SubscriptionTokenImplBase(SubscriptionTokenImplBase&&) =
delete;
26 SubscriptionTokenImplBase& operator=(SubscriptionTokenImplBase&&) =
delete;
28 SubscriptionTokenImplBase(
const SubscriptionTokenImplBase&) =
delete;
29 SubscriptionTokenImplBase& operator=(
const SubscriptionTokenImplBase&&) =
delete;
31 virtual ~SubscriptionTokenImplBase();
33 virtual void SetMaxQueueLength(size_t length) = 0;
35 virtual void Unsubscribe() = 0;
45class [[nodiscard]] SubscriptionToken
final {
47 using OnMessageCb = std::function<
void(
const std::string& channel,
const std::string& message)>;
49 std::function<
void(
const std::string& pattern,
const std::string& channel,
const std::string& message)>;
52 SubscriptionToken(SubscriptionToken&&)
noexcept;
60 SubscriptionToken& operator=(SubscriptionToken&&)
noexcept;
73 bool IsEmpty()
const noexcept {
return impl_ ==
nullptr; }
76 std::unique_ptr<impl::SubscriptionTokenImplBase> impl_;