Documentation ¶
Index ¶
- func SetDigestWaitTime(time time.Duration)
- func SetRequestWaitTime(time time.Duration)
- func SetResponseWaitTime(time time.Duration)
- type DigestFilter
- type PullAdapter
- type PullEngine
- func (engine *PullEngine) Add(seqs ...string)
- func (engine *PullEngine) OnDigest(digest []string, nonce uint64, context interface{})
- func (engine *PullEngine) OnHello(nonce uint64, context interface{})
- func (engine *PullEngine) OnReq(items []string, nonce uint64, context interface{})
- func (engine *PullEngine) OnRes(items []string, nonce uint64)
- func (engine *PullEngine) Remove(seqs ...string)
- func (engine *PullEngine) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DigestFilter ¶
DigestFilter筛选要发送到远程对等机的摘要 根据消息的上下文发送了问候或请求
type PullAdapter ¶
type PullAdapter interface { //selectpeers返回一个对等机切片,引擎将使用该切片启动协议 SelectPeers() []string //hello发送hello消息以启动协议 //并返回一个期望返回的nonce //在摘要消息中。 Hello(dest string, nonce uint64) //sendDigest将摘要发送到远程pullengine。 //上下文参数指定要发送到的远程引擎。 SendDigest(digest []string, nonce uint64, context interface{}) //sendreq将一组项目发送到某个已标识的远程拉器引擎 //用绳子 SendReq(dest string, items []string, nonce uint64) //sendres将一组项目发送到由上下文标识的远程pullengine。 SendRes(items []string, context interface{}, nonce uint64) }
拉具发动机需要拉转接器,以便 向远程pullengine实例发送消息。 pullengine应该用 OnHello, OnDigest, OnReq, OnRes when the respective message arrives 从远程拉发动机
type PullEngine ¶
type PullEngine struct { PullAdapter // contains filtered or unexported fields }
pullengine是实际调用pull算法的组件 在PullAdapter的帮助下
func NewPullEngine ¶
func NewPullEngine(participant PullAdapter, sleepTime time.Duration) *PullEngine
newpullengine创建具有特定睡眠时间的pullengine实例 在拉动启动之间
func NewPullEngineWithFilter ¶
func NewPullEngineWithFilter(participant PullAdapter, sleepTime time.Duration, df DigestFilter) *PullEngine
newpullenginewithfilter创建具有特定睡眠时间的pullengine实例 在拉式启动之间,并在发送摘要和响应时使用给定的筛选器
func (*PullEngine) OnDigest ¶
func (engine *PullEngine) OnDigest(digest []string, nonce uint64, context interface{})
OnDigest通知引擎摘要已到达
func (*PullEngine) OnHello ¶
func (engine *PullEngine) OnHello(nonce uint64, context interface{})
OnHello通知引擎已到达Hello
func (*PullEngine) OnReq ¶
func (engine *PullEngine) OnReq(items []string, nonce uint64, context interface{})
OnReq通知引擎请求已到达
func (*PullEngine) OnRes ¶
func (engine *PullEngine) OnRes(items []string, nonce uint64)
OnRes通知引擎响应已到达
Click to show internal directories.
Click to hide internal directories.