batch

package module
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Copyright (C) THL A29 Limited, a Tencent company. All rights reserved.

SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const (
	DefaultBatchMaxSize       = 100
	DefaultBatchCreateTimeout = 1000 * time.Millisecond
	DefaultPoolSize           = 10000
	TxPoolType                = "BATCH"
)
View Source
const (
	DefaultMaxTxCount          = 1000         // Maximum number of transactions in a block
	DefaultMaxTxPoolSize       = 5120         // Maximum number of common transaction in the pool
	DefaultMaxConfigTxPoolSize = 100          // Maximum number of config transaction in the pool
	DefaultMaxTxTimeTimeout    = float64(600) // The unit is in seconds
)

Variables

View Source
var (
	TxPoolConfig *txPoolConfig
)

Functions

func IsMetrics

func IsMetrics() bool

IsMetrics Whether to log operation time

func IsTxTimeVerify

func IsTxTimeVerify(chainConf protocol.ChainConf) bool

===========config in the blockchain============ IsTxTimeVerify Whether transactions require validation

func MaxCommonTxPoolSize

func MaxCommonTxPoolSize() int

===========config in the local============ MaxCommonTxPoolSize Maximum number of common transaction in the pool

func MaxConfigTxPoolSize

func MaxConfigTxPoolSize() int

MaxConfigTxPoolSize The maximum number of configure transaction in the pool

func MaxTxCount

func MaxTxCount(chainConf protocol.ChainConf) int

MaxTxCount Maximum number of transactions in a block

func MaxTxTimeTimeout

func MaxTxTimeTimeout(chainConf protocol.ChainConf) float64

MaxTxTimeTimeout The maximum timeout for a transaction

func NewBatchTxPool

func NewBatchTxPool(
	nodeId string,
	chainId string,
	chainStore protocol.BlockchainStore,
	msgBus msgbus.MessageBus,
	chainConf protocol.ChainConf,
	ac protocol.AccessControlProvider,
	log protocol.Logger,
	monitorEnabled bool,
	poolConfig map[string]interface{}) (protocol.TxPool, error)

Types

type BatchTxPool

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

BatchTxPool Another implementation of tx pool, which can only be used in non-Hotstuff consensus algorithms

func (*BatchTxPool) AddTx

func (p *BatchTxPool) AddTx(tx *commonPb.Transaction, src protocol.TxSource) error

func (*BatchTxPool) AddTxsToPendingCache

func (p *BatchTxPool) AddTxsToPendingCache(txs []*commonPb.Transaction, blockHeight uint64)

func (*BatchTxPool) Apply

func (p *BatchTxPool) Apply(opts ...Option) error

func (*BatchTxPool) FetchTxBatch

func (p *BatchTxPool) FetchTxBatch(blockHeight uint64) []*commonPb.Transaction

func (*BatchTxPool) GetTxByTxId

func (p *BatchTxPool) GetTxByTxId(txId string) (tx *commonPb.Transaction, inBlockHeight uint64)

func (*BatchTxPool) GetTxsByTxIds

func (p *BatchTxPool) GetTxsByTxIds(txIds []string) (map[string]*commonPb.Transaction, map[string]uint64)

func (*BatchTxPool) OnMessage

func (p *BatchTxPool) OnMessage(message *msgbus.Message)

func (*BatchTxPool) OnQuit

func (p *BatchTxPool) OnQuit()

func (*BatchTxPool) RetryAndRemoveTxs

func (p *BatchTxPool) RetryAndRemoveTxs(retryTxs []*commonPb.Transaction, removeTxs []*commonPb.Transaction)

func (*BatchTxPool) SetBatchCreateTimeout

func (p *BatchTxPool) SetBatchCreateTimeout(timeout time.Duration)

func (*BatchTxPool) SetBatchMaxSize

func (p *BatchTxPool) SetBatchMaxSize(size int)

func (*BatchTxPool) SetMsgBus

func (p *BatchTxPool) SetMsgBus(msgBus msgbus.MessageBus)

func (*BatchTxPool) SetPoolSize

func (p *BatchTxPool) SetPoolSize(size int)

func (*BatchTxPool) Start

func (p *BatchTxPool) Start() error

func (*BatchTxPool) Stop

func (p *BatchTxPool) Stop() error

func (*BatchTxPool) TxExists

func (p *BatchTxPool) TxExists(tx *commonPb.Transaction) bool

type Option

type Option func(p *BatchTxPool) error

func WithBatchCreateTimeout

func WithBatchCreateTimeout(timeout time.Duration) Option

func WithBatchMaxSize

func WithBatchMaxSize(maxSize int) Option

func WithMsgBus

func WithMsgBus(msgBus msgbus.MessageBus) Option

func WithPoolSize

func WithPoolSize(size int) Option

Jump to

Keyboard shortcuts

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