You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.5 KiB

using CoreAgent.WebSocketTransport.Models;
namespace CoreAgent.WebSocketTransport.Interfaces;
/// <summary>
/// 消息通道管理器接口
/// 单一职责:管理所有消息通道
/// </summary>
public interface IMessageChannelManager : IDisposable
{
/// <summary>
/// 获取发送消息通道
/// </summary>
IMessageChannel<object> SendChannel { get; }
/// <summary>
/// 获取接收消息通道
/// </summary>
IMessageChannel<object> ReceiveChannel { get; }
/// <summary>
/// 获取优先级消息通道(用于心跳等)
/// </summary>
IMessageChannel<HeartbeatMessage> PriorityChannel { get; }
/// <summary>
/// 获取通道状态信息
/// </summary>
/// <returns>通道状态信息</returns>
ChannelStatusInfo GetStatusInfo();
/// <summary>
/// 清空所有通道
/// </summary>
void ClearAllChannels();
/// <summary>
/// 完成所有通道
/// </summary>
void CompleteAllChannels();
}
/// <summary>
/// 通道状态信息
/// </summary>
public class ChannelStatusInfo
{
public int SendChannelCount { get; set; }
public int ReceiveChannelCount { get; set; }
public int PriorityChannelCount { get; set; }
public int SendChannelCapacity { get; set; }
public int ReceiveChannelCapacity { get; set; }
public int PriorityChannelCapacity { get; set; }
public bool SendChannelCompleted { get; set; }
public bool ReceiveChannelCompleted { get; set; }
public bool PriorityChannelCompleted { get; set; }
}