dbsync

package
v0.0.0-...-1abf0d1 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MetadataChannel exchanges DB metadata
	MetadataChannel = p2p.ChannelID(0x70)

	// FileChannel exchanges file data
	FileChannel = p2p.ChannelID(0x71)

	LightBlockChannel = p2p.ChannelID(0x72)

	ParamsChannel = p2p.ChannelID(0x73)

	MetadataHeightFilename   = "LATEST_HEIGHT"
	HeightSubdirectoryPrefix = "snapshot_"
	MetadataFilename         = "METADATA"
)
View Source
const ApplicationDBSubdirectory = "application.db"
View Source
const LockFile = "LOCK"
View Source
const WasmDirectory = "wasm/wasm/state/wasm"

TODO: this is bad as TM shouldn't be aware of wasm. DB sync/restore logic should ideally happen on application-level (i.e. Cosmos layer) and communicate to TM via new ABCI methods

View Source
const WasmSuffix = "_wasm"

Variables

This section is empty.

Functions

func GetFileChannelDescriptor

func GetFileChannelDescriptor() *p2p.ChannelDescriptor

func GetLightBlockChannelDescriptor

func GetLightBlockChannelDescriptor() *p2p.ChannelDescriptor

func GetMetadataChannelDescriptor

func GetMetadataChannelDescriptor() *p2p.ChannelDescriptor

func GetParamsChannelDescriptor

func GetParamsChannelDescriptor() *p2p.ChannelDescriptor

func Snapshot

func Snapshot(height uint64, dbsyncConfig config.DBSyncConfig, baseConfig config.BaseConfig) error

Types

type Reactor

type Reactor struct {
	service.BaseService
	// contains filtered or unexported fields
}

func NewReactor

func NewReactor(
	logger log.Logger,
	config config.DBSyncConfig,
	baseConfig config.BaseConfig,
	peerEvents p2p.PeerEventSubscriber,
	stateStore sm.Store,
	blockStore *store.BlockStore,
	initialHeight int64,
	chainID string,
	eventBus *eventbus.EventBus,
	shouldSync bool,
	postSyncHook func(context.Context, sm.State) error,
) *Reactor

func (*Reactor) OnStart

func (r *Reactor) OnStart(ctx context.Context) error

func (*Reactor) OnStop

func (r *Reactor) OnStop()

func (*Reactor) SetFileChannel

func (r *Reactor) SetFileChannel(ch *p2p.Channel)

func (*Reactor) SetLightBlockChannel

func (r *Reactor) SetLightBlockChannel(ch *p2p.Channel)

func (*Reactor) SetMetadataChannel

func (r *Reactor) SetMetadataChannel(ch *p2p.Channel)

func (*Reactor) SetParamsChannel

func (r *Reactor) SetParamsChannel(ch *p2p.Channel)

type Syncer

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

func NewSyncer

func NewSyncer(
	logger log.Logger,
	dbsyncConfig config.DBSyncConfig,
	baseConfig config.BaseConfig,
	enable bool,
	metadataRequestFn func(context.Context) error,
	fileRequestFn func(context.Context, types.NodeID, uint64, string) error,
	commitStateFn func(context.Context, uint64) (sm.State, *types.Commit, error),
	postSyncFn func(context.Context, sm.State, *types.Commit) error,
	resetDirFn func(*Syncer),
) *Syncer

func (*Syncer) Process

func (s *Syncer) Process(ctx context.Context)

func (*Syncer) PushFile

func (s *Syncer) PushFile(file *dstypes.FileResponse)

func (*Syncer) SetMetadata

func (s *Syncer) SetMetadata(ctx context.Context, sender types.NodeID, metadata *dstypes.MetadataResponse)

func (*Syncer) Stop

func (s *Syncer) Stop()

Jump to

Keyboard shortcuts

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