scheduler

package
v0.0.0-...-cfab22a Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2016 License: GPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrDataError = 1000 + iota
	ErrInputError
)
View Source
const (
	ErrDbError = 2000 + iota
)
View Source
const ErrOk = 0

Variables

This section is empty.

Functions

This section is empty.

Types

type PoliteVisitor

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

func InitPoliteVisitor

func InitPoliteVisitor(pool *pool.Pool, minVisitInterval int64) *PoliteVisitor

func (*PoliteVisitor) GetLastVisitTime

func (this *PoliteVisitor) GetLastVisitTime(domain string, hostname string) int64

hget hostname domain

func (*PoliteVisitor) IsPolite

func (this *PoliteVisitor) IsPolite(domain string, hostname string) bool

a convenient wrapper

func (*PoliteVisitor) SetLastVisitTime

func (this *PoliteVisitor) SetLastVisitTime(domain string, hostname string, ts int64) error

hset hostname domain ts

type Scheduler

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

func InitScheduler

func InitScheduler(db *sqlx.DB, config map[string]string) *Scheduler

func (*Scheduler) AddTasksFromRules

func (this *Scheduler) AddTasksFromRules()

从规则库导入任务

func (*Scheduler) DispatchTasks

func (this *Scheduler) DispatchTasks()

分发task给Fetcher

func (*Scheduler) FetchTasks

func (this *Scheduler) FetchTasks() ([]types.CrawlTask, error)

获取等待调度的任务

func (*Scheduler) Run

func (this *Scheduler) Run()

Jump to

Keyboard shortcuts

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