chrobot

package
v0.0.2-debug Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChCollector

type ChCollector interface {
	GetData() <-chan *collectordto.BlockData
	Close()
}

type ChCollectorCreator

type ChCollectorCreator func(ctx context.Context,
	dataReady chan<- struct{},
	srcChName string, startFrom uint64) (ChCollector, error)

type ChExecutor

type ChExecutor interface {
	// CalcBatchSize calculates and returns batch size (in bytes) which will be sent to chaincode,
	// in method Execute
	CalcBatchSize(b *executordto.Batch) (uint, error)

	// Execute sends batch to chaincode and returns num of block in which batch was committed.
	// minHeight - the minimum height that peers must have in order to execute batch
	Execute(ctx context.Context, b *executordto.Batch, minHeight uint64) (uint64, error)
	Close()
}

ChExecutor is component that performs actions related to the execution of a batch.

type ChExecutorCreator

type ChExecutorCreator func(ctx context.Context) (ChExecutor, error)

type ChRobot

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

func CreateRobots added in v0.0.3

func CreateRobots(ctx context.Context, cfg *config.Config, hlfProfile *hlfprofile.HlfProfile) ([]*ChRobot, error)

CreateRobots - creates robots specified by config

func NewRobot

func NewRobot(ctx context.Context,
	chName string, initMinExecBlockNum uint64,
	chsSources map[string]uint64,
	collectorCr ChCollectorCreator,
	chExecutorCr ChExecutorCreator,
	chStor ChStorage,
	batchLimits collectorbatch.Limits,
) *ChRobot

func (*ChRobot) ChName

func (chr *ChRobot) ChName() string

func (*ChRobot) Collectors added in v0.0.3

func (chr *ChRobot) Collectors() []*chCollector

func (*ChRobot) CreateCollectors added in v0.0.3

func (chr *ChRobot) CreateCollectors(ctx context.Context) error

CreateCollectors - creates robot collectors

func (*ChRobot) Run

func (chr *ChRobot) Run(ctx context.Context) error

type ChStorage

type ChStorage interface {
	SaveCheckPoints(ctx context.Context, cp *stordto.ChCheckPoint) (*stordto.ChCheckPoint, error)
	LoadCheckPoints(ctx context.Context) (*stordto.ChCheckPoint, bool, error)
}

Jump to

Keyboard shortcuts

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