log

package
v0.0.0-...-ad94bd4 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Overview

Package log provides the underlying functionality for managing log data structures.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDupeLeaf is returned by the Sequence method of storage implementations to
	// indicate that a leaf has already been sequenced.
	ErrDupeLeaf = errors.New("duplicate leaf")

	// ErrSeqAlreadyAssigned is returned by the Assign method of storage implementations
	// to indicate that the provided sequence number is already in use.
	ErrSeqAlreadyAssigned = errors.New("sequence number already assigned")
)

Functions

func Integrate

func Integrate(ctx context.Context, fromSize uint64, st Storage, h merkle.LogHasher) (*log.Checkpoint, error)

Integrate adds all sequenced entries greater than fromSize into the tree. Returns an updated Checkpoint, or an error.

Types

type Storage

type Storage interface {
	// GetTile returns the tile at the given level & index.
	GetTile(ctx context.Context, level, index, logSize uint64) (*api.Tile, error)

	// StoreTile stores the tile at the given level & index.
	StoreTile(ctx context.Context, level, index uint64, tile *api.Tile) error

	// WriteCheckpoint stores a newly updated log checkpoint.
	WriteCheckpoint(ctx context.Context, newCPRaw []byte) error

	// Sequence assigns sequence numbers to the passed in entry.
	// Returns the assigned sequence number for the leafhash.
	//
	// If a duplicate leaf is sequenced the storage implementation may return
	// the sequence number associated with an earlier instance, along with a
	// ErrDupeLeaf error.
	Sequence(ctx context.Context, leafhash []byte, leaf []byte) (uint64, error)

	// ScanSequenced calls f for each contiguous sequenced log entry >= begin.
	// It should stop scanning if the call to f returns an error.
	ScanSequenced(ctx context.Context, begin uint64, f func(seq uint64, entry []byte) error) (uint64, error)
}

Storage represents the set of functions needed by the log tooling.

Jump to

Keyboard shortcuts

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