send

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 14 Imported by: 1 module, 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 send is beefcat's near end: it cuts a stream of bytes into carriers, each spending one mined funding output of the home's, and writes them as frames.

Sending asks nothing of the chain. The funding trees were mined ahead (beefcat fund), each kept with its Merkle path, and every carrier carries the tree it spends from and that path, so the far end verifies with nothing but its own block headers.

A funding output is marked spent in the home's state before its carrier is signed: a run that stops part way never signs a second carrier on the same output.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoPostage = errors.New("out of postage: no mined funding output is left (run `beefcat fund`)")

ErrNoPostage is a home with no mined funding output left.

Functions

func Need

func Need(size int64, chunk int) uint64

Need is how many carriers a stream of size bytes takes in chunks of chunk (zero is wire.MaxData).

Types

type Sender

type Sender struct {
	Wallet     wallet.Interface
	Originator string
	Identity   [33]byte
	State      *home.State
	// Chunk is the most data one carrier holds; zero is wire.MaxData.
	Chunk int
	// Lines sends each line of input as it arrives, one carrier a line,
	// and closes the stream with an empty last carrier.
	Lines bool
	// Workers is how many carriers are signed at once; zero is one per
	// core, at most 16.
	Workers int
	// contains filtered or unexported fields
}

Sender sends streams from one home.

func (*Sender) Stream

func (s *Sender) Stream(ctx context.Context, r io.Reader, w io.Writer) (Stats, error)

Stream reads r to its end and writes it to w as one stream of carriers.

Input is cut into chunks in order, each given its sequence number and a funding output as it is read. No carrier depends on another's bytes, so they are signed on several cores, and written in the order they were read.

type Stats

type Stats struct {
	Stream   [16]byte
	Carriers int
	Bytes    int64
	// Wire is the bytes written: frames and preamble.
	Wire int64
}

Stats are what one stream sent.

Jump to

Keyboard shortcuts

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