/*
* Copyright (c) 2023 Vaughn Nugent
*
* Library: VNLib
* Package: ObjectCacheServer
* File: ICacheEventQueueManager.cs
*
* ICacheEventQueueManager.cs is part of ObjectCacheServer which is part of the larger
* VNLib collection of libraries and utilities.
*
* ObjectCacheServer is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* ObjectCacheServer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
using System;
namespace VNLib.Data.Caching.ObjectCache.Server
{
///
/// Represents a managment system for publishing and subscribing to cache change events
///
internal interface ICacheEventQueueManager
{
///
/// Publishes a change event to all subscribers
///
/// The change event to publish
void PublishSingle(ChangeEvent change);
///
/// Publishes multiple change events to all subscribers
///
/// The span of changes to publish to all subscribers
void PublishMultiple(Span changes);
///
/// Attatches a subscriber that will receive all published changes
///
/// The peer node that wishes to subscribe for events
/// The initilaizes event queue for the single subscriber
IPeerEventQueue Subscribe(ICachePeer peer);
///
/// Detatches a subscriber from the event queue
///
/// The peer to unsubscribe from events
void Unsubscribe(ICachePeer peer);
///
/// Purges all stale subcriber nodes
///
void PurgeStaleSubscribers();
}
}