fetcher

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetArriveTimeout

func SetArriveTimeout(duration time.Duration)

SetArriveTimeout set timeout.

Types

type ExecutorFunc

type ExecutorFunc func(types.Message)

ExecutorFunc defines the execution function.

type ExpireFunc

type ExpireFunc func()

ExpireFunc defines the timeout execution function.

type Fetcher

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

Fetcher manages the logic associated with fetch.

func NewFetcher

func NewFetcher() *Fetcher

NewFetcher returns a new pointer to the Fetcher.

func (*Fetcher) AddTask

func (f *Fetcher) AddTask(id string, match MatchFunc, executor ExecutorFunc, expire ExpireFunc)

AddTask adds a fetcher task.

func (*Fetcher) Len

func (f *Fetcher) Len() int

Len returns the number of existing tasks.

func (*Fetcher) MatchTask

func (f *Fetcher) MatchTask(id string, message types.Message) bool

MatchTask matching task.

func (*Fetcher) Start

func (f *Fetcher) Start()

Start turns on for Fetch.

func (*Fetcher) Stop

func (f *Fetcher) Stop()

Stop turns off for Fetch.

type LimitFetcher

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

LimitFetcher tag the fetching request that is happening Limit the frequency of the same requests

func NewLimitFetcher

func NewLimitFetcher() *LimitFetcher

NewLimitFetcher returns a new pointer to the LimitFetcher.

func (*LimitFetcher) AddTask

func (f *LimitFetcher) AddTask(id common.Hash) bool

AddTask adds a fetcher task.

func (*LimitFetcher) Stop

func (f *LimitFetcher) Stop()

Stop turns off for LimitFetcher.

type MatchFunc

type MatchFunc func(types.Message) bool

MatchFunc is a function that judges the matching of messages.

Jump to

Keyboard shortcuts

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