pipeline

package
v0.0.0-...-f0734c7 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

from net/textproto

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pipeline

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

A Pipeline manages a pipelined in-order request/response sequence.

To use a Pipeline p to manage multiple clients on a connection, each client should run:

id := p.Next()	// take a number

p.StartRequest(id)	// wait for turn to send request
«send request»
p.EndRequest(id)	// notify Pipeline that request is sent

p.StartResponse(id)	// wait for turn to read response
«read response»
p.EndResponse(id)	// notify Pipeline that response is read

A pipelined server can use the same calls to ensure that responses computed in parallel are written in the correct order.

func (*Pipeline) EndRequest

func (p *Pipeline) EndRequest(id uint)

EndRequest notifies p that the request with the given id has been sent (or, if this is a server, received).

func (*Pipeline) EndResponse

func (p *Pipeline) EndResponse(id uint)

EndResponse notifies p that the response with the given id has been received (or, if this is a server, sent).

func (*Pipeline) Next

func (p *Pipeline) Next() uint

Next returns the next id for a request/response pair.

func (*Pipeline) StartRequest

func (p *Pipeline) StartRequest(id uint)

StartRequest blocks until it is time to send (or, if this is a server, receive) the request with the given id.

func (*Pipeline) StartResponse

func (p *Pipeline) StartResponse(id uint)

StartResponse blocks until it is time to receive (or, if this is a server, send) the request with the given id.

Jump to

Keyboard shortcuts

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