worker

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DbOperator

type DbOperator interface {
	GetShortChain() ([]utils.HeightInfo, error)
	SaveParsedBlocks(ctx context.Context, blocks []ParsedBlockInfo) error
	GetLastBlockHeight() (*uint64, error)
	TrimBlockchain(ctx context.Context, height uint64) error
	GetBlockHash(height uint64) (*moneroutil.Hash, error)
}

func NewDbOperator

func NewDbOperator(settings utils.DbSettings) (DbOperator, error)

type NodeFetcher

type NodeFetcher interface {
	GetBlocks(shortChain []utils.HeightInfo, lastHeight uint64) (*moneroproto.GetBlocksFastResponse, error)
}

func NewNodeFetcher

func NewNodeFetcher(nodeAddress string) (NodeFetcher, error)

type ParsedBlockInfo

type ParsedBlockInfo struct {
	Height       uint64
	Hash         moneroutil.Hash
	Header       []byte
	Timestamp    uint32
	Transactions []ParsedTransactionInfo
}

type ParsedTransactionInfo

type ParsedTransactionInfo struct {
	Hash          moneroutil.Hash
	Blob          []byte
	OutputKeys    []moneroutil.Key
	OutputIndices []uint64
	UsedInInputs  []uint64
	Timestamp     uint32
}

type PgOperator

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

func (*PgOperator) GetBlockHash

func (p *PgOperator) GetBlockHash(height uint64) (*moneroutil.Hash, error)

func (*PgOperator) GetLastBlockHeight

func (p *PgOperator) GetLastBlockHeight() (*uint64, error)

func (*PgOperator) GetShortChain

func (p *PgOperator) GetShortChain() ([]utils.HeightInfo, error)

func (*PgOperator) SaveParsedBlocks

func (p *PgOperator) SaveParsedBlocks(ctx context.Context, blocks []ParsedBlockInfo) error

func (*PgOperator) TrimBlockchain

func (p *PgOperator) TrimBlockchain(ctx context.Context, height uint64) error

type RealNodeFetcher

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

func (*RealNodeFetcher) GetBlocks

func (r *RealNodeFetcher) GetBlocks(shortChain []utils.HeightInfo, lastHeight uint64) (*moneroproto.GetBlocksFastResponse, error)

TODO: make cancellation

type Worker

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

func NewWorker

func NewWorker(db DbOperator, node NodeFetcher, genesisInfo *genesis.GenesisBlockInfo) *Worker

func (*Worker) CheckGenesis

func (w *Worker) CheckGenesis(ctx context.Context, init bool) error

func (*Worker) RunSyncLoop

func (w *Worker) RunSyncLoop(ctx context.Context) <-chan error

Jump to

Keyboard shortcuts

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