controller

package
v0.1.1-0...-c572a67 Latest Latest
Warning

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

Go to latest
Published: May 22, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotInited      = errors.New("controller/controller.go call Controller.Init first")
	ErrWorkerCount    = errors.New("controller/controller.go worker count must between 0 and 1000")
	ErrNilCrawlerItem = errors.New("controller/controller.go CrawlerItem is nil")
	ErrNamesNotSame   = errors.New("controller/controller.go CrawlerNames are not the same")
	ErrNameTaken      = errors.New("controller/controller.go CrawlerName already taken")
	ErrNoName         = errors.New("controller/controller.go no CrawlerName")
)
View Source
var (
	ErrNilList      = errors.New("SortedList is nil")
	ErrTotalWeight  = errors.New("SortedList totalWeight 0")
	ErrNeverHappen  = errors.New("weighted random selection error")
	ErrNameNotFound = errors.New("crawler name not found")
)
View Source
var StoreNames = []string{"crawler", "seed", "running", "crontab"}

Functions

This section is empty.

Types

type Controller

type Controller struct {
	Crawlers    map[string]crawler.Crawler
	Schduler    CrawlerScheduler
	Stores      map[string]*store.LevelStore
	WorkerCount int
	// contains filtered or unexported fields
}

func (*Controller) CloseCrawler

func (self *Controller) CloseCrawler(name string) error

func (*Controller) DelCrawler

func (self *Controller) DelCrawler(name string) error

func (*Controller) Finish

func (self *Controller) Finish()

func (*Controller) Init

func (self *Controller) Init(dir string, wc int) error

func (*Controller) Run

func (self *Controller) Run()

func (*Controller) UpdateCrawler

func (self *Controller) UpdateCrawler(item *types.CrawlerItem, isNew bool) error

type CrawlerScheduler

type CrawlerScheduler struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*CrawlerScheduler) Init

func (self *CrawlerScheduler) Init()

func (*CrawlerScheduler) Insert

func (self *CrawlerScheduler) Insert(item Item) error

func (*CrawlerScheduler) Remove

func (self *CrawlerScheduler) Remove(name string) error

func (*CrawlerScheduler) WeightedChoice

func (self *CrawlerScheduler) WeightedChoice() (string, error)

type Item

type Item struct {
	CrawlerName string
	Weight      int
}

Jump to

Keyboard shortcuts

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