limits

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 3 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 limits is the blogs command's policy limits: the defaults and hard caps of docs/limits.md, and the checks that apply them to a producer's and a reader's settings.

None of these is a wire format or a signed bound (docs/frozen.md). The record bounds every reader accepts (spec section 11) are logrec's; the limits here are what a producer chooses to send and what a reader or an archive chooses to ask for, so a later version may change any of them without a new record version. A hard cap refuses the setting with an error naming the limit and why; a recommendation warns and goes on.

Index

Constants

View Source
const (
	FragmentPayload = 1128
	PlanePackets    = 64
	// PlaneObjectAim is the largest carrier BEEF, in bytes, that stays
	// within PlanePackets fragments.
	PlaneObjectAim = FragmentPayload * PlanePackets
	// OpenObjectBound is BRC-149's bound on an object submitted on the open
	// path; MaxObjectBound the authenticated path's. No plane admits more.
	OpenObjectBound = 1 << 20
	MaxObjectBound  = 8 << 20
)

The plane's object size. An object larger than one packet is carried as BRC-130 fragments at the fabric's MTU floor of 1280 bytes: less the IPv6 (40), UDP (8) and fragment (104) headers, 1128 bytes of object each. Every lost fragment is repaired by NACK, and the reassembly of the whole object must finish within a fixed 10 s; the more fragments, the likelier one needs a second repair round and the object is abandoned. Measured: 12 % of 64-packet objects lost at 1 % loss with a 141 ms round trip, none of the 1- and 8-packet ones.

View Source
const (
	// PlaneMaxBytes is the default bytes of lines per full-bytes lines
	// batch on the plane: with a 100-output funding tree and a proof, its
	// carrier's BEEF is 54,727 bytes, 49 fragments (measured). At
	// PlaneMaxBytesWarn it is 71,119 bytes, 64 fragments; above it a
	// carrier passes PlanePackets.
	PlaneMaxBytes     = 48 << 10
	PlaneMaxBytesWarn = 64 << 10
	// PlaneGzipMaxBytes is the default bytes of lines per gzip batch on the
	// plane; log lines compress several times over, so the carried content
	// is of the same order as PlaneMaxBytes.
	PlaneGzipMaxBytes = 256 << 10
	// UnicastMaxBytes is the default per full-bytes lines batch in unicast
	// mode: the record's carried bound, which each host takes over HTTP.
	UnicastMaxBytes = logrec.MaxContent
	// LargeMaxBytes is the default for gzip in unicast mode and for
	// digest-only in either mode, whose content does not ride the plane.
	LargeMaxBytes = 1 << 20

	DefaultMaxLines = 10000
	MaxLines        = 65536

	DefaultMaxWait = time.Second
	MinMaxWait     = 10 * time.Millisecond
	MaxMaxWait     = time.Hour
)

Batch cutting.

View Source
const (
	DefaultInterval      = 10 * time.Minute
	MinInterval          = time.Minute
	MaxInterval          = 24 * time.Hour
	DefaultAnchorBatches = 4096
	MaxAnchorBatches     = logrec.MaxIntervalBatches
)

Anchors.

View Source
const (
	// DefaultRate and MaxRate bound the batches a stream publishes per
	// second.
	DefaultRate = 2
	MaxRate     = 50
	// DefaultTreeCount and MaxTreeCount bound a batch funding tree's
	// outputs; every carrier's BEEF carries its tree. MaxTreeCount bounds an
	// anchor fee tree too, under bcommon's mint.MaxFundingOutputs (1023), so
	// a larger tree is refused before a run rather than at its mint.
	// PlaneTreeCountWarn
	// is where the tree alone is about 10 fragments.
	DefaultTreeCount   = 100
	MaxTreeCount       = 1000
	PlaneTreeCountWarn = 250
	// MaxHosts is the most hosts a command is configured with.
	// UnicastHostsWarn is where a unicast producer's upload per object is
	// better done by the plane.
	MaxHosts         = 16
	UnicastHostsWarn = 5
	// MinTimeout and MaxTimeout bound one request.
	MinTimeout = time.Second
	MaxTimeout = 5 * time.Minute
	// MaxStreams is the most streams one producer home holds.
	MaxStreams = 64
)

Publishing.

View Source
const (
	// DefaultRecheck is how many stored seqs an archive pass asks the host
	// about again, oldest checked first; MaxRecheck the most one pass may
	// be given (-recheck-all asks about every one).
	DefaultRecheck = 1024
	MaxRecheck     = 65536
	// MaxReadBatches is the most batches one read prints.
	MaxReadBatches = 65536
	// ContentDirFreeWarn is the free space under which a digest-only
	// producer is warned about its content directory.
	ContentDirFreeWarn = 1 << 30
)

Readers and archives.

Variables

This section is empty.

Functions

func DefaultMaxBytes

func DefaultMaxBytes(plane, digest, gzip bool) int

DefaultMaxBytes is -max-bytes when none is given, by mode and profile.

func Gap

func Gap(rate float64) time.Duration

Gap is the least time between two batches of a stream at rate batches per second.

Types

type Producer

type Producer struct {
	Plane           bool
	Hosts           int
	Need            int
	Digest          bool
	Gzip            bool
	MaxBytes        int
	MaxLines        int
	MaxWait         time.Duration
	Interval        time.Duration
	AnchorBatches   int
	Rate            float64
	TreeCount       int
	AnchorTreeCount int
	ObjectBound     int
}

Producer is a producer's settings, as the checks see them.

func (Producer) Check

func (p Producer) Check() (warnings []string, err error)

Check applies the hard caps, returning the first broken as an error, and the recommendations, returning each passed as a warning.

Jump to

Keyboard shortcuts

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