长安链源码分析之网络模块 net-liquid(5)
本文已参与「开源摘星计划」,欢迎正在阅读的你加入。活动链接:https://github.com/weopenprojects/WeOpen-Star
core/discovery 节点发现相关接口定义,包含 Announcer、Discoverer 以及两者组合封装接口 Discovery。
core/groupmulticast 组播组件接口定义。
复制代码
本文字数:728 字
阅读完需:约 1 分钟
本文已参与「开源摘星计划」,欢迎正在阅读的你加入。活动链接:https://github.com/weopenprojects/WeOpen-Star
core/discovery 节点发现相关接口定义,包含 Announcer、Discoverer 以及两者组合封装接口 Discovery。
core/groupmulticast 组播组件接口定义。
type GroupMulticast interface {
// AddPeerToGroup add peers to the group which name is the given groupName. // If the group not exists, it will be created. //添加节点到一个组里面 AddPeerToGroup(groupName string, peers ...peer.ID)
// RemovePeerFromGroup remove peers from the group which name is the given groupName. //从组里面移除节点 RemovePeerFromGroup(groupName string, peers ...peer.ID)
// GroupSize return the count of peers in the group which name is the given. // If the group not exists, return 0. //返回指定组中的节点数量 GroupSize(groupName string) int
// InGroup return whether the peer in the group. // If group not exists, return false. //判断节点是否在组中 InGroup(groupName string, peer peer.ID) bool
// RemoveGroup remove a group which name is the given. //删除一个组 RemoveGroup(groupName string)
// SendToGroupSync send data to the peers in the group sync. // It will wait until all data send success. //发送数据给指定组里面所有节点,同步发送 SendToGroupSync(groupName string, protocolID protocol.ID, data []byte) error
//SendToGroupAsync send data to group, no wait //发送数据给指定组,异步发送 SendToGroupAsync(groupName string, protocolID protocol.ID, data []byte)}还未添加个人签名 2018-05-04 加入
还未添加个人简介

促进软件开发及相关领域知识与创新的传播
京公网安备 11010502039052号

评论