tendermint/lite/provider.go

33 lines
1014 B
Go
Raw Normal View History

2017-11-09 14:37:18 -08:00
package lite
2017-10-24 03:34:36 -07:00
import (
2018-07-02 11:58:07 -07:00
log "github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/types"
)
2017-10-24 03:34:36 -07:00
// Provider provides information for the lite client to sync validators.
// Examples: MemProvider, files.Provider, client.Provider, CacheProvider.
type Provider interface {
2017-10-24 03:34:36 -07:00
// LatestFullCommit returns the latest commit with minHeight <= height <=
// maxHeight.
// If maxHeight is zero, returns the latest where minHeight <= height.
LatestFullCommit(chainID string, minHeight, maxHeight int64) (FullCommit, error)
2017-10-24 03:34:36 -07:00
// Get the valset that corresponds to chainID and height and return.
// Height must be >= 1.
ValidatorSet(chainID string, height int64) (*types.ValidatorSet, error)
// Set a logger.
SetLogger(logger log.Logger)
2017-10-24 03:34:36 -07:00
}
// A provider that can also persist new information.
// Examples: MemProvider, files.Provider, CacheProvider.
type PersistentProvider interface {
Provider
2017-10-24 03:34:36 -07:00
// SaveFullCommit saves a FullCommit (without verification).
SaveFullCommit(fc FullCommit) error
2017-10-24 03:34:36 -07:00
}