Documentation ¶
Index ¶
Constants ¶
View Source
const ( AllChecks = iota SkipBlacklisting )
View Source
const ( LogFormatCommon = "common" PoolFormatDwarf = "dwarf" PoolFormatUley = "uley" ProcessorFormatDisabled = "disabled" )
Variables ¶
This section is empty.
Functions ¶
func NewBlacklistWatcher ¶ added in v0.4.9
Types ¶
type AntiFraud ¶
type AntiFraud interface { Run(ctx context.Context) error DealOpened(deal *sonm.Deal) error TrackTask(ctx context.Context, deal *sonm.Deal, taskID string) error FinishDeal(ctx context.Context, deal *sonm.Deal, optsFlags flags) error }
func NewAntiFraud ¶
func NewAntiFraud(cfg Config, log *zap.Logger, processors ProcessorFactory, dealFactory types.DealFactory, nodeConnection *grpc.ClientConn) AntiFraud
type Config ¶
type Config struct { TaskQuality float64 `yaml:"task_quality" required:"true"` QualityCheckInterval time.Duration `yaml:"quality_check_interval" default:"15s"` BlacklistCheckInterval time.Duration `yaml:"blacklist_check_interval" default:"5m"` ConnectionTimeout time.Duration `yaml:"connection_timeout" default:"60s"` LogProcessorConfig LogProcessorConfig `yaml:"log_processor"` PoolProcessorConfig PoolProcessorConfig `yaml:"pool_processor"` Whitelist []common.Address `yaml:"whitelist"` }
type LogProcessorConfig ¶
type LogProcessorConfig struct { ProcessorConfig `yaml:",inline"` Pattern string `yaml:"pattern" required:"true"` Field int `yaml:"field"` Multiplier float64 `yaml:"multiplier" required:"true"` LogDir string `yaml:"log_dir"` }
type Option ¶ added in v0.4.9
type Option func(options *processorOpts)
func WithClientConn ¶ added in v0.4.9
func WithClientConn(cc *grpc.ClientConn) Option
func WithLogger ¶ added in v0.4.9
type PoolProcessorConfig ¶ added in v0.4.13
type PoolProcessorConfig struct { ProcessorConfig `yaml:",inline"` URL string `yaml:"url"` }
type Processor ¶ added in v0.4.9
type Processor interface { Run(ctx context.Context) error TaskID() string TaskQuality() (accurate bool, quality float64) }
Processor is part of AntiFraud module that continuously processing results of container execution (like logs, pool reports, etc) and calculate task quality value.
type ProcessorConfig ¶ added in v0.4.9
type ProcessorFactory ¶ added in v0.4.9
type ProcessorFactory interface { LogProcessor(deal *types.Deal, taskID string, opts ...Option) Processor PoolProcessor(deal *types.Deal, taskID string, opts ...Option) Processor }
ProcessorFactory builds particular processors for the anti-fraud
func NewProcessorFactory ¶ added in v0.4.9
func NewProcessorFactory(cfg *Config) ProcessorFactory
Click to show internal directories.
Click to hide internal directories.