flowcontrol

package
v2.1.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2019 License: GPL-3.0 Imports: 3 Imported by: 3

Documentation

Overview

Package flowcontrol implements a client side flow control mechanism

Package flowcontrol implements a client side flow control mechanism

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 returns the minimum waiting time required before sending a request with the given maximum estimated cost. Second return value is the relative estimated buffer level after sending the request (divided by BufLimit).

func (*ServerNode) GotReply

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

GotReply adjusts estimated buffer value according to the value included in the latest request reply.

func (*ServerNode) QueueRequest

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

QueueRequest should be called when the request has been assigned to the given server node, before putting it in the send queue. It is mandatory that requests are sent in the same order as the QueueRequest calls are made.

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