Documentation ¶
Overview ¶
Package filtercommon transaction filter parameter check
Package filtercommon transaction filter common tools ¶
Package filtercommon transaction filter common config ¶
Package filtercommon stat common
Index ¶
- Variables
- func ChaseBlockHeight(store protocol.BlockchainStore, filter protocol.TxFilter, log protocol.Logger) error
- func CheckBNConfig(c localconf.BirdsNestConfig, isSnapshot bool) string
- func CheckShardingBNConfig(c localconf.ShardingBirdsNestConfig) string
- func CheckSnapshot(c localconf.SnapshotSerializerConfig) string
- func LoggingFixLength(format string, args ...interface{}) string
- func LoggingFixLengthFunc(format string, args ...interface{}) func() string
- func NewStat(fpCount uint32, filterCosts, dbCosts time.Duration) *txfilter.Stat
- func NewStat0(filterCosts, dbCosts time.Duration) *txfilter.Stat
- func NewStat1(filterCosts, dbCosts time.Duration) *txfilter.Stat
- type TxFilterConfig
- type TxFilterLogger
- type TxFilterType
Constants ¶
This section is empty.
Variables ¶
var ( // StringNil If the error string is not equal to StringNil then you need to returnup StringNil = "" // ErrStrSharding Error string prefix "sharding." ErrStrSharding = "sharding." // ErrStrBirdsNest Error string prefix "brids_nest." ErrStrBirdsNest = "brids_nest." // ErrStrCuckoo Error string prefix "cuckoo." ErrStrCuckoo = "cuckoo." // ErrStrSnapshot snapshot. Error string prefix snapshot. ErrStrSnapshot = "snapshot." // ErrStrInvalidShardingTimeoutMustBeGreaterThan1 Invalid sharding timeout must be greater than 1 ErrStrInvalidShardingTimeoutMustBeGreaterThan1 = ErrStrSharding + "timeout must be greater than 1" // ErrStrInvalidShardingLengthRange2_50 Invalid sharding size range: 2_50 ErrStrInvalidShardingLengthRange2_50 = ErrStrSharding + "length range 2 ~ 50" // ErrStrBirdsNestLength bird's nest length must range from 2 to 100 ErrStrBirdsNestLength = ErrStrBirdsNest + "length must range from 2 to 100" // ErrStrSnapshotPathCannotBeNil snapshot path cannot be nil ErrStrSnapshotPathCannotBeNil = ErrStrSnapshot + "path cannot be nil" // ErrStrSnapshotSerializeIntervalMustBeGreaterThan0 snapshot serialize_interval must be greater than 0 ErrStrSnapshotSerializeIntervalMustBeGreaterThan0 = ErrStrSnapshot + "serialize_interval must be greater than 0" // ErrStrRulesAbsoluteExpireTimeMustBeGreaterThan0 absolute expire time must be greater than 0 ErrStrRulesAbsoluteExpireTimeMustBeGreaterThan0 = "rules.absolute_expire_time must be greater than 0" // ErrStrCuckooKeyTypeNotSupport cuckoo key type not support ErrStrCuckooKeyTypeNotSupport = ErrStrCuckoo + "key_type %v not support" // ErrStrInvalidCuckooTableTypeNotSupport cuckoo table_type not support ErrStrInvalidCuckooTableTypeNotSupport = ErrStrCuckoo + "table_type not support" // ErrStrInvalidCuckooBitsPerItemMustBeGreaterThan0 cuckoo bits_per_item must be greater than 0 ErrStrInvalidCuckooBitsPerItemMustBeGreaterThan0 = ErrStrCuckoo + "bits_per_item must be greater than 0" // ErrStrInvalidCuckooMaxNumKeysMustBeGreaterThan0 cuckoo max_num_keys must be greater than 0 ErrStrInvalidCuckooMaxNumKeysMustBeGreaterThan0 = ErrStrCuckoo + "max_num_keys must be greater than 0" // ErrStrInvalidCuckooTagsPerBucketMustBeGreaterThan0 cuckoo tags_per_bucket must be greater than 0 ErrStrInvalidCuckooTagsPerBucketMustBeGreaterThan0 = ErrStrCuckoo + "tags_per_bucket must be greater than 0" )
Functions ¶
func ChaseBlockHeight ¶
func ChaseBlockHeight(store protocol.BlockchainStore, filter protocol.TxFilter, log protocol.Logger) error
ChaseBlockHeight Chase high block
func CheckBNConfig ¶
func CheckBNConfig(c localconf.BirdsNestConfig, isSnapshot bool) string
CheckBNConfig check bird's nest configuration
func CheckShardingBNConfig ¶
func CheckShardingBNConfig(c localconf.ShardingBirdsNestConfig) string
CheckShardingBNConfig check sharding bird's nest configuration
func CheckSnapshot ¶
func CheckSnapshot(c localconf.SnapshotSerializerConfig) string
CheckSnapshot check snapshot configuration
func LoggingFixLength ¶
LoggingFixLength The string length is fixed to avoid outputting a large number of logs
func LoggingFixLengthFunc ¶
LoggingFixLengthFunc The string length is fixed to avoid outputting a large number of logs
Types ¶
type TxFilterConfig ¶
type TxFilterConfig struct { // Transaction filter type Type TxFilterType `json:"type,omitempty"` // Bird's nest configuration BirdsNest *bn.BirdsNestConfig `json:"birds_nest,omitempty"` // Sharding bird's nest configuration ShardingBirdsNest *sbn.ShardingBirdsNestConfig `json:"sharding_birds_nest,omitempty"` }
TxFilterConfig transaction filter config
func GetConf ¶
func GetConf(chainId string) (*TxFilterConfig, error)
GetConf Get the configuration of the transaction filter
func ToPbConfig ¶
func ToPbConfig(conf localconf.TxFilterConfig, chainId string) (*TxFilterConfig, error)
ToPbConfig Convert localconf.TxFilterConfig to config.TxFilterConfig
type TxFilterLogger ¶
type TxFilterLogger struct {
// contains filtered or unexported fields
}
TxFilterLogger protocol.Logger wrapper
func NewLogger ¶
func NewLogger(log protocol.Logger) *TxFilterLogger
NewLogger new logger by protocol.Logger
func (TxFilterLogger) Debugf ¶
func (t TxFilterLogger) Debugf(format string, args ...interface{})
Debugf debug sprintf
func (TxFilterLogger) Errorf ¶
func (t TxFilterLogger) Errorf(format string, args ...interface{})
Errorf error sprintf
func (TxFilterLogger) Infof ¶
func (t TxFilterLogger) Infof(format string, args ...interface{})
Infof info sprintf
func (TxFilterLogger) Warnf ¶
func (t TxFilterLogger) Warnf(format string, args ...interface{})
Warnf warning sprintf
type TxFilterType ¶
type TxFilterType int32
TxFilterType Transaction filter type
const ( // TxFilterTypeDefault Default transaction filter type TxFilterTypeDefault TxFilterType = 0 // TxFilterTypeBirdsNest Bird's Nest transaction filter type TxFilterTypeBirdsNest TxFilterType = 1 // TxFilterTypeMap Map transaction filter type TxFilterTypeMap TxFilterType = 2 // TxFilterTypeShardingBirdsNest Sharding Bird's Nest transaction filter type TxFilterTypeShardingBirdsNest TxFilterType = 3 )