writecontrol

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package writecontrol shares outbound-progress notifications between the transport and protocol packages without adding public factory methods.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Watch

func Watch(source any, fn func(sent int)) bool

Watch registers fn on source's write control and reports whether source supports write-progress notifications.

Types

type Access

type Access[T Getter] struct{}

Access exposes only a package-private capability. Embedding this zero-sized value first in a connection preserves its layout and lets sibling packages subscribe to outbound progress without adding public methods. The original source is passed through so a getter can support promoted access from concrete wrappers.

type Control

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

Control notifies watchers when an output boundary retires wire bytes (sent > 0) or opens queue/window capacity without a socket send (sent == 0).

Watchers run on the goroutine that retired the output or advanced the protocol window, so they must return promptly and must not block, write to, or close the connection synchronously.

func ControlOf

func ControlOf(source any) *Control

ControlOf resolves source's shared write control, or nil if unsupported.

func New

func New(inexact bool) *Control

New constructs a write controller. inexact marks a boundary whose path passes through an OutboundHolder, where wire byte counts cannot prove a specific queued write left until OutboundBuffered reaches zero.

func (*Control) Inexact

func (c *Control) Inexact() bool

Inexact reports whether wire byte counts below this boundary may expand or retransmit held payload before reaching the socket.

func (*Control) Notify

func (c *Control) Notify(sent int)

Notify delivers an outbound progress or room event to every watcher.

func (*Control) Watch

func (c *Control) Watch(fn func(sent int))

Watch registers fn to receive future outbound progress notifications.

type Getter

type Getter interface {
	GetWriteControl(source any) *Control
}

Getter locates the write control belonging to the original dynamic output boundary. Implement it on a private zero-sized type in the boundary's owning package.

type TurnReserver

type TurnReserver interface {
	ReserveTurnWrite(n int) ([]byte, bool, error)
}

TurnReserver reserves turn-local contiguous outbound space without public methods on uio.Conn or uio.Lower.

Jump to

Keyboard shortcuts

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