flowcontrol

package
v0.0.0-...-92cc422 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2019 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

包流控制实现客户端流控制机制

包流控制实现客户端流控制机制

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientManager

type ClientManager struct {
	// contains filtered or unexported fields
}

func NewClientManager

func NewClientManager(rcTarget, maxSimReq, maxRcSum uint64) *ClientManager

func (*ClientManager) Stop

func (self *ClientManager) Stop()

type ClientNode

type ClientNode struct {
	// contains filtered or unexported fields
}

func NewClientNode

func NewClientNode(cm *ClientManager, params *ServerParams) *ClientNode

func (*ClientNode) AcceptRequest

func (peer *ClientNode) AcceptRequest() (uint64, bool)

func (*ClientNode) Remove

func (peer *ClientNode) Remove(cm *ClientManager)

func (*ClientNode) RequestProcessed

func (peer *ClientNode) RequestProcessed(cost uint64) (bv, realCost uint64)

type ServerNode

type ServerNode struct {
	// contains filtered or unexported fields
}

func NewServerNode

func NewServerNode(params *ServerParams) *ServerNode

func (*ServerNode) CanSend

func (peer *ServerNode) CanSend(maxCost uint64) (time.Duration, float64)

cansend返回发送请求前所需的最小等待时间 以给定的最大估计成本。第二个返回值是相对值 发送请求后的估计缓冲区级别(除以buflimit)。

func (*ServerNode) GotReply

func (peer *ServerNode) GotReply(reqID, bv uint64)

gotmreply根据包含在 最新的请求回复。

func (*ServerNode) QueueRequest

func (peer *ServerNode) QueueRequest(reqID, maxCost uint64)

当请求已分配给给定的 服务器节点,然后将其放入发送队列。必须要求 以与发出QueuerRequest调用相同的顺序发送。

type ServerParams

type ServerParams struct {
	BufLimit, MinRecharge uint64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL