mirror

package
v0.20260901.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const MaxPackagesPerRequest = 32

MaxPackagesPerRequest is the most entry packages a client should send in one add-entries request per c2sp.org/tlog-mirror.

Variables

This section is empty.

Functions

func AddCheckpointRequest

func AddCheckpointRequest(oldSize int64, proof []tlog.Hash, signedCheckpoint []byte) ([]byte, error)

AddCheckpointRequest builds the add-checkpoint request body per c2sp.org/tlog-witness. The proof must be a Merkle consistency proof from oldSize to the checkpoint's size, empty when oldSize is zero.

func AddEntriesRequest

func AddEntriesRequest(logOrigin string, uploadStart, uploadEnd int64, ticket []byte, packages [][]byte) ([]byte, error)

AddEntriesRequest builds the add-entries request body. The packages must be a prefix of the canonical sequence for [uploadStart, uploadEnd), marshaled by EntryPackage.

func EntryPackage

func EntryPackage(entries [][]byte, proof []tlog.Hash) ([]byte, error)

EntryPackage builds the wire form of one entry package.

func ParseSizeResponse

func ParseSizeResponse(body []byte) (int64, error)

ParseSizeResponse parses the text/x.tlog.size body of a "409 Conflict" add-checkpoint response, which carries the tree size of the mirror's latest pending checkpoint.

Types

type MirrorInfo

type MirrorInfo struct {
	// TreeSize is the tree size to use as upload_end in the next request. The
	// mirror repeats the request's upload_end if it is still a pending
	// checkpoint, otherwise it sends its current pending checkpoint's size.
	TreeSize int64
	// NextEntry is the entry to use as upload_start in the next request. It is
	// the first entry the mirror does not hold.
	NextEntry int64
	// Ticket is an opaque ticket value to send back in the next request.
	Ticket []byte
}

MirrorInfo is a parsed text/x.tlog.mirror-info body from a "409 Conflict" or "202 Accepted" add-entries response.

func ParseMirrorInfo

func ParseMirrorInfo(body []byte) (MirrorInfo, error)

ParseMirrorInfo parses a text/x.tlog.mirror-info response body.

type Package

type Package struct {
	// SubtreeStart begins the subtree consistency proof's interval,
	// [SubtreeStart, End).
	SubtreeStart int64
	// EntriesStart begins the carried entries, [EntriesStart, End), exceeding
	// SubtreeStart only for the first package of an upload that does not begin
	// on a package boundary.
	EntriesStart int64
	// End is the exclusive end of both intervals.
	End int64
}

Package holds the boundaries of one entry package of an add-entries upload.

func Packages

func Packages(uploadStart, uploadEnd, maxPackages int64) ([]Package, error)

Packages returns the first maxPackages packages of the canonical sequence for an upload of the entries in [uploadStart, uploadEnd). The sequence is empty when uploadStart equals uploadEnd.

Jump to

Keyboard shortcuts

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