//------------------------------------------------------------------------------
// 此代码版权(除特别声明或在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
{
///
/// ITargetRpcActor
///
public partial interface ITargetRpcActor : ITargetRpcClient
{
///
/// 创建一个和其他客户端的通道
///
/// 目标客户端ID
///
///
public Channel CreateChannel(string targetId);
///
/// 创建一个和其他客户端的通道
///
/// 目标客户端ID
/// 通道Id
///
///
public Channel CreateChannel(string targetId, int id);
///
/// 向指定的Id执行ping。
///
/// 目标客户端ID
/// 超时配置
/// 如果返回True,则表示一定在线。如果返回false,则不一定代表不在线。
bool Ping(string targetId, int timeout = 5000);
#region 文件传输
///
/// 从对点拉取文件
///
/// 目标客户端ID
/// 文件传输操作器
///
Result PullFile(string targetId, FileOperator fileOperator);
///
/// 异步从对点拉取文件
///
/// 目标客户端ID
/// 文件传输操作器
///
Task PullFileAsync(string targetId, FileOperator fileOperator);
///
/// 向对点推送文件
///
/// 目标客户端ID
/// 文件传输操作器
///
Result PushFile(string targetId, FileOperator fileOperator);
///
/// 异步向对点推送文件
///
/// 目标客户端ID
/// 文件传输操作器
///
Task PushFileAsync(string targetId, FileOperator fileOperator);
#endregion 文件传输
#region 小文件
///
/// 拉取小文件。默认设置1024*1024字节大小。
///
/// 目标客户端ID
/// 请求路径
/// 元数据
/// 超时设置
/// 可取消令箭
///
PullSmallFileResult PullSmallFile(string targetId, string path, Metadata metadata = null, int timeout = 5000, CancellationToken token = default);
///
/// 拉取小文件。默认设置1024*1024字节大小。
///
/// 目标客户端Id
/// 请求路径
/// 元数据
/// 超时设置
/// 可取消令箭
///
Task PullSmallFileAsync(string targetId, string path, Metadata metadata = null, int timeout = 5000, CancellationToken token = default);
///
/// 推送小文件到特定的Id。默认设置1024*1024字节大小。
///
/// 目标客户端Id
/// 保存路径
/// 推送的文件信息
/// 元数据
/// 超时设置
/// 可取消令箭
///
Result PushSmallFile(string targetId, string savePath, FileInfo fileInfo, Metadata metadata = null, int timeout = 5000, CancellationToken token = default);
///
/// 推送小文件。默认设置1024*1024字节大小。
///
///
/// 保存路径
/// 推送的文件信息
/// 元数据
/// 超时设置
/// 可取消令箭
///
Task PushSmallFileAsync(string targetId, string savePath, FileInfo fileInfo, Metadata metadata = null, int timeout = 5000, CancellationToken token = default);
#endregion 小文件
}
}