chrobot

package
v0.0.0-...-7107d2d Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 11 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()
}

ChCollector is component that collects data from the source channel.

type ChCollectorCreator

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

ChCollectorCreator is a function that creates a new ChCollector

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)

ChExecutorCreator is a function that creates a new ChExecutor

type ChRobot

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

ChRobot is a robot that collects data from the source channels and sends it to the destination channel.

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

NewRobot creates a new robot

func (*ChRobot) ChName

func (chr *ChRobot) ChName() string

ChName returns name of the channel

func (*ChRobot) Run

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

Run starts the robot

type ChStorage

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

ChStorage is a interface for save and load checkpoints

Jump to

Keyboard shortcuts

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