distribute

package
v0.0.0-...-2d91a95 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2017 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MasterAPI

func MasterAPI(n Distributer) teleport.API

MasterAPI the master node API

func SlaveAPI

func SlaveAPI(n Distributer) teleport.API

SlaveAPI : Create a slave node API

Types

type Distributer

type Distributer interface {
	// The master node sends a task from the repository
	Send(clientNum int) Task
	// Receive a task from the node to the repository
	Receive(task *Task)
	// Returns the number of nodes connected to it
	CountNodes() int
}

Distributer : Distributed interface

type Task

type Task struct {
	ID             int
	Spiders        []map[string]string // spider rule name field with keyin field, specify format map [string] string {"name": "baidu", "keyIn": "henry"}
	ThreadNum      int                 // global maximum concurrency
	Pausetime      int64               // pause duration reference / ms (random: Pausetime / 2 ~ Pausetime * 2)
	OutType        string              // output method
	DockerCap      int                 // Subdivide container capacity
	DockerQueueCap int                 // Segment output pool capacity, not less than 2
	SuccessInherit bool                // inherit history success record
	FailureInherit bool                // inherit history failure record
	Limit          int64               // set the upper limit, 0 is not limited, if the rule is set to the initial value of Limit is a custom limit, otherwise the default limit request number
	ProxyMinute    int64               // The number of minutes of proxy IP replacement
	// Optional
	KeyIns string // Custom input, late cut into multiple tasks KeyIn custom configuration
}

Task : for distributed distribution tasks

type TaskJar

type TaskJar struct {
	Tasks chan *Task
}

TaskJar : task repository

func NewTaskJar

func NewTaskJar() *TaskJar

NewTaskJar :

func (*TaskJar) Len

func (taskJar *TaskJar) Len() int

Len : Total number of warehouse tasks

func (*TaskJar) Pull

func (taskJar *TaskJar) Pull() *Task

Pull : The client gets a task from the local repository

func (*TaskJar) Push

func (taskJar *TaskJar) Push(task *Task)

Push : The server adds a task to the repository

func (*TaskJar) Receive

func (taskJar *TaskJar) Receive(task *Task)

Receive : receive a task from the node to the repository

func (*TaskJar) Send

func (taskJar *TaskJar) Send(clientNum int) Task

Send : The master node sends a task from the repository

Jump to

Keyboard shortcuts

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