store

package
v0.34.0-dev1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2020 License: Apache-2.0 Imports: 2 Imported by: 10 modules, 18 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

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSignedHeaderNotFound is returned when a store does not have the
	// requested header.
	ErrSignedHeaderNotFound = errors.New("signed header not found")

	// ErrValidatorSetNotFound is returned when a store does not have the
	// requested validator set.
	ErrValidatorSetNotFound = errors.New("validator set not found")
)

Functions

This section is empty.

Types

type Store

type Store interface {
	// SaveSignedHeaderAndValidatorSet saves a SignedHeader (h: sh.Height) and a
	// ValidatorSet (h: sh.Height).
	//
	// height must be > 0.
	SaveSignedHeaderAndValidatorSet(sh *types.SignedHeader, valSet *types.ValidatorSet) error

	// DeleteSignedHeaderAndValidatorSet deletes SignedHeader (h: height) and
	// ValidatorSet (h: height).
	//
	// height must be > 0.
	DeleteSignedHeaderAndValidatorSet(height int64) error

	// SignedHeader returns the SignedHeader that corresponds to the given
	// height.
	//
	// height must be > 0.
	//
	// If SignedHeader is not found, ErrSignedHeaderNotFound is returned.
	SignedHeader(height int64) (*types.SignedHeader, error)

	// ValidatorSet returns the ValidatorSet that corresponds to height.
	//
	// height must be > 0.
	//
	// If ValidatorSet is not found, ErrValidatorSetNotFound is returned.
	ValidatorSet(height int64) (*types.ValidatorSet, error)

	// LastSignedHeaderHeight returns the last (newest) SignedHeader height.
	//
	// If the store is empty, -1 and nil error are returned.
	LastSignedHeaderHeight() (int64, error)

	// FirstSignedHeaderHeight returns the first (oldest) SignedHeader height.
	//
	// If the store is empty, -1 and nil error are returned.
	FirstSignedHeaderHeight() (int64, error)

	// SignedHeaderBefore returns the SignedHeader before a certain height.
	//
	// height must be > 0 && <= LastSignedHeaderHeight.
	SignedHeaderBefore(height int64) (*types.SignedHeader, error)

	// Prune removes headers & the associated validator sets when Store reaches a
	// defined size (number of header & validator set pairs).
	Prune(size uint16) error

	// Size returns a number of currently existing header & validator set pairs.
	Size() uint16
}

Store is anything that can persistenly store headers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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