hlf

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const ErrReqSizeMarker = "is bigger than request max bytes"

Variables

This section is empty.

Functions

func IsEndorsementMismatchErr

func IsEndorsementMismatchErr(err error) bool

IsEndorsementMismatchErr checks if the error is a mismatch.

func IsOrderingReqSizeExceededErr added in v0.0.3

func IsOrderingReqSizeExceededErr(err error) bool

IsOrderingReqSizeExceededErr checks error message for containing ErrReqSizeMarker

func LogBatchContent added in v0.0.3

func LogBatchContent(log glog.Logger, b *executordto.Batch)

func SplitBatchForExec added in v0.0.3

func SplitBatchForExec(executedTxsCount, lastSuccessCount, lastErrorCount int, origBatch *executordto.Batch, log glog.Logger) *executordto.Batch

SplitBatchForExec splits transactions, based on results of previous executions of a batch executedTxsCount - amount of transactions that were successfully executed and must be skipped lastSuccessCount - amount of transactions that were successfully executed previously, next batch must be the same or less lastErrorCount - amount of transactions that were not successfully executed previously, next batch must be less

Types

type ChCollector added in v0.0.3

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

func CreateChCollectorAdv added in v0.0.3

func CreateChCollectorAdv(ctx context.Context,
	log glog.Logger, m metrics.Metrics,
	srcChName string, startFrom uint64,
	connectionProfile, userName, orgName string,
	proxyEvents chan<- *fab.BlockEvent,
	rc realCollector,
	createEventsSrc func(ctx context.Context, startFrom uint64) (EventsSrc, error),
	delayAfterSrcError time.Duration,
	awaitEventsTimeout time.Duration,
) *ChCollector

CreateChCollectorAdv - creates advanced channel collector

func (*ChCollector) Close added in v0.0.3

func (cc *ChCollector) Close()

func (*ChCollector) GetData added in v0.0.3

func (cc *ChCollector) GetData() <-chan *collectordto.BlockData

type ChCollectorCreator

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

func CreateChCollectorCreatorFromConfig added in v0.0.3

func CreateChCollectorCreatorFromConfig(
	cfg *config.Config,
	hlfProfile *hlfprofile.HlfProfile,
	rCfg *config.Robot,
) ChCollectorCreator

CreateChCollectorCreatorFromConfig creates ChCollectorCreator specified by robot config

func NewChCollectorCreator

func NewChCollectorCreator(
	dstChName string,
	connectionProfile string,
	userName string,
	orgName string,
	txPrefixes parserdto.TxPrefixes,
	bufSize uint,
) ChCollectorCreator

type ChExecutor added in v0.0.3

type ChExecutor struct {
	// args
	Log     glog.Logger
	Metrics metrics.Metrics
	ChName  string

	Executor             Executor
	RetryExecuteAttempts uint
	RetryExecuteMaxDelay time.Duration
	RetryExecuteDelay    time.Duration
	// contains filtered or unexported fields
}

func CreateChExecutor added in v0.0.3

func CreateChExecutor(
	ctx context.Context,
	chName string,
	connectionProfile string,
	userName string,
	orgName string,
	execOpts ExecuteOptions,
) (*ChExecutor, error)

CreateChExecutor creates New ChExecutor

func (*ChExecutor) CalcBatchSize added in v0.0.3

func (che *ChExecutor) CalcBatchSize(b *executordto.Batch) (uint, error)

func (*ChExecutor) Close added in v0.0.3

func (che *ChExecutor) Close()

func (*ChExecutor) Execute added in v0.0.3

func (che *ChExecutor) Execute(ctx context.Context, b *executordto.Batch, _ uint64) (uint64, error)

type ChExecutorCreator

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

func CreateChExecutorCreatorFromConfig added in v0.0.3

func CreateChExecutorCreatorFromConfig(
	cfg *config.Config,
	hlfProfile *hlfprofile.HlfProfile,
	rCfg *config.Robot,
) (ChExecutorCreator, error)

CreateChExecutorCreatorFromConfig - creates ChExecutorCreator specified by robot config

func NewChExecutorCreator

func NewChExecutorCreator(
	chName string,
	connectionProfile string,
	user string,
	org string,
	execOpts ExecuteOptions,
) ChExecutorCreator

type EventsSrc added in v0.0.3

type EventsSrc interface {
	Close()
	GetEvents() <-chan *fab.BlockEvent
}

EventsSrc - event source

type ExecWithSplitHlp added in v0.0.3

type ExecWithSplitHlp struct {
	Log                        glog.Logger
	ExecuteBatch               func(ctx context.Context, b *executordto.Batch) (uint64, error)
	ReqSizeExceededErrCallBack func(b *executordto.Batch, num int)
	ReqSizeExceededErrNum      int
}

ExecWithSplitHlp - struct for execution with split

func NewExecWithSplitHlp added in v0.0.3

func NewExecWithSplitHlp(
	log glog.Logger,
	executeBatch func(ctx context.Context, b *executordto.Batch) (uint64, error),
	reqSizeExceededErrCallBack func(b *executordto.Batch, num int),
) *ExecWithSplitHlp

func (*ExecWithSplitHlp) Execute added in v0.0.3

func (hlp *ExecWithSplitHlp) Execute(ctx context.Context, b *executordto.Batch) (uint64, error)

func (*ExecWithSplitHlp) RaiseReqSizeExceededIfErr added in v0.0.3

func (hlp *ExecWithSplitHlp) RaiseReqSizeExceededIfErr(b *executordto.Batch, err error)

type ExecuteOptions

type ExecuteOptions struct {
	ExecuteTimeout time.Duration
}

type Executor added in v0.0.3

type Executor interface {
	Execute(ctx context.Context, req channel.Request) (channel.Response, error)
}

Jump to

Keyboard shortcuts

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