Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrBlockDataOutOfLimit = errors.New("block data out of limit")
ErrBlockDataOutOfLimit is returned when the block data is out of limit
Functions ¶
This section is empty.
Types ¶
type BatchInfo ¶
type BatchInfo struct { // Kind is a kind of batch limit Kind LimitKind // BlocksCount is a count of blocks in batch BlocksCount uint // Len is a length of batch Len uint // Size is a size of batch Size uint // Sources is a map with info about sources Sources map[string]*SrcInfo }
BatchInfo is a struct with info about batch
type CBatch ¶
type CBatch struct {
// contains filtered or unexported fields
}
CBatch is a struct with info about batch
func NewBatch ¶
func NewBatch( ctx context.Context, chName string, limits Limits, calcBatchSize func(b *executordto.Batch) (uint, error), ) *CBatch
NewBatch creates a new batch
func (*CBatch) AddIfInLimit ¶
AddIfInLimit adds block data to batch if batch is not limited
func (*CBatch) GetBatchForExec ¶
func (b *CBatch) GetBatchForExec() (*executordto.Batch, *BatchInfo)
GetBatchForExec returns batch for execution
type LimitKind ¶
type LimitKind string
LimitKind is a type for batch limit kind
const ( // NoneLimitKind is a kind of batch limit when batch is not limited NoneLimitKind LimitKind = "None" // BlocksCountLimitKind is a kind of batch limit when batch is limited by blocks count BlocksCountLimitKind LimitKind = "BlocksCountLimit" // TimeoutLimitKind is a kind of batch limit when batch is limited by timeout TimeoutLimitKind LimitKind = "TimeoutLimit" // LenLimitKind is a kind of batch limit when batch is limited by length LenLimitKind LimitKind = "LenLimit" // SizeLimitKind is a kind of batch limit when batch is limited by size SizeLimitKind LimitKind = "SizeLimit" )
type Limits ¶
type Limits struct { // BlocksCountLimit is a limit for blocks count in batch BlocksCountLimit uint // TimeoutLimit is a limit for batch execution time TimeoutLimit time.Duration // LenLimit is a limit for batch length LenLimit uint // SizeLimit is a limit for batch size SizeLimit uint }
Limits is a struct with limits for batch
Click to show internal directories.
Click to hide internal directories.