files

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2017 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Ext      = ".tsd"
	ValDir   = "validators"
	CheckDir = "checkpoints"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider stores all data in the filesystem We assume the same validator hash may be reused by many different headers/Checkpoints, and thus store it separately. This leaves us with three issues:

1. Given a validator hash, retrieve the validator set if previously stored 2. Given a block height, find the Checkpoint with the highest height <= h 3. Given a Seed, store it quickly to satisfy 1 and 2

Note that we do not worry about caching, as that can be achieved by pairing this with a MemStoreProvider and CacheProvider from certifiers

func NewProvider

func NewProvider(dir string) Provider

NewProvider creates the parent dir and subdirs for validators and checkpoints as needed

func (Provider) GetByHash

func (m Provider) GetByHash(hash []byte) (certifiers.Seed, error)

func (Provider) GetByHeight

func (m Provider) GetByHeight(h int) (certifiers.Seed, error)

func (Provider) StoreSeed

func (m Provider) StoreSeed(seed certifiers.Seed) error

Jump to

Keyboard shortcuts

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