//------------------------------------------------------------------------------
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
// CSDN博客:https://blog.csdn.net/qq_40374647
// 哔哩哔哩视频:https://space.bilibili.com/94253567
// Gitee源代码仓库:https://gitee.com/RRQM_Home
// Github源代码仓库:https://github.com/RRQM
// API首页:https://www.yuque.com/rrqm/touchsocket/index
// 交流QQ群:234762506
// 感谢您的下载和使用
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using TouchSocket.Core;
namespace TouchSocket.Rpc.TouchRpc
{
///
/// RpcActor接口
///
public partial interface IRpcActor : IRpcActorBase, IRpcClient, ITargetRpcActor
{
///
/// 表示是否已经完成握手连接。
///
bool IsHandshaked { get; }
///
/// 根路径
///
string RootPath { get; set; }
///
/// 判断使用该ID的Channel是否存在。
///
///
///
bool ChannelExisted(int id);
///
/// 创建通道
///
///
///
Channel CreateChannel();
///
/// 创建通道
///
/// 指定ID
///
///
Channel CreateChannel(int id);
///
/// 从对点拉取文件
///
///
///
Result PullFile(FileOperator fileOperator);
///
/// 异步从对点拉取文件
///
///
///
Task PullFileAsync(FileOperator fileOperator);
///
/// 拉取小文件。默认设置1024*1024字节大小。
///
/// 请求路径
/// 元数据
/// 超时设置
/// 可取消令箭
///
PullSmallFileResult PullSmallFile(string path, Metadata metadata = null, int timeout = 5000, CancellationToken token = default);
///
/// 拉取小文件。默认设置1024*1024字节大小。
///
/// 请求路径
/// 元数据
/// 超时设置
/// 可取消令箭
///
Task PullSmallFileAsync(string path, Metadata metadata = null, int timeout = 5000, CancellationToken token = default);
///
/// 向对点推送文件
///
///
///
Result PushFile(FileOperator fileOperator);
///
/// 异步向对点推送文件
///
///
///
Task PushFileAsync(FileOperator fileOperator);
///
/// 推送小文件。默认设置1024*1024字节大小。
///
/// 保存路径
/// 推送的文件信息
/// 元数据
/// 超时设置
/// 可取消令箭
///
Result PushSmallFile(string savePath, FileInfo fileInfo, Metadata metadata = null, int timeout = 5000, CancellationToken token = default);
///
/// 推送小文件。默认设置1024*1024字节大小。
///
/// 保存路径
/// 推送的文件信息
/// 元数据
/// 超时设置
/// 可取消令箭
///
Task PushSmallFileAsync(string savePath, FileInfo fileInfo, Metadata metadata = null, int timeout = 5000, CancellationToken token = default);
///
/// 重新设置ID
///
///
void ResetID(string newId);
///
/// 发送流数据
///
///
///
///
///
Result SendStream(Stream stream, StreamOperator streamOperator, Metadata metadata = default);
///
/// 异步发送流数据
///
///
///
///
///
Task SendStreamAsync(Stream stream, StreamOperator streamOperator, Metadata metadata = default);
///
/// 订阅通道
///
///
///
///
bool TrySubscribeChannel(int id, out Channel channel);
}
}