rpc

package
v0.0.0-...-f0efb94 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2015 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RPC_TYPE = "tcp"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type RpcClient

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

func NewRpcClient

func NewRpcClient(node node.Node, cluster cluster.Cluster) *RpcClient

func (RpcClient) CloseSpider

func (this RpcClient) CloseSpider(nodeName, spiderName string) error

func (*RpcClient) Connect

func (this *RpcClient) Connect(ip string, port int) error

for now it is for master connect to slave

func (*RpcClient) Detect

func (this *RpcClient) Detect()

judge if node is down

func (*RpcClient) Dial

func (this *RpcClient) Dial(ip string, port int) (*rpc.Client, error)

start a rpc client if ok , store if

func (*RpcClient) Distribute

func (this *RpcClient) Distribute(nodeName string, request *http.Request) error

* this is rpc method of request *

func (*RpcClient) LetMeIn

func (this *RpcClient) LetMeIn(ip string, port int) error

* this is rpc method of cluster *

func (*RpcClient) ReportResult

func (this *RpcClient) ReportResult(nodeName string, result *crawler.ScrapeResult) error

for slave send crawl result to master

func (*RpcClient) Start

func (this *RpcClient) Start()

func (*RpcClient) StartSpider

func (this *RpcClient) StartSpider(nodeName, spiderName string) error

func (*RpcClient) StopNode

func (this *RpcClient) StopNode(nodeName string) error

top node

func (*RpcClient) SyncClusterInfo

func (this *RpcClient) SyncClusterInfo()

type RpcServer

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

func NewRpcServer

func NewRpcServer(node node.Node, cluster cluster.Cluster, port int, rpcClient action.RpcClientAnts, reporter, distributer action.Watcher) *RpcServer

func (*RpcServer) AcceptRequest

func (this *RpcServer) AcceptRequest(request *action.DistributeRequest, response *action.DistributeReqponse) error

expose method ,for accept method

func (*RpcServer) AcceptResult

func (this *RpcServer) AcceptResult(request *action.ReportRequest, response *action.ReportResponse) error

for master accept crawl result if no more request to crawl stop it notice: * local request do not go through this way * close action also start by reporter

func (*RpcServer) CloseSpider

func (this *RpcServer) CloseSpider(request *action.CloseSpiderRequest, response *action.CloseSpiderResponse) error

func (*RpcServer) Connect

func (this *RpcServer) Connect(request *action.RpcBase, response *action.RpcBase) error

just tell who i am

func (*RpcServer) IsAlive

func (this *RpcServer) IsAlive(request *action.RpcBase, response *action.RpcBase) error

is server alive

func (*RpcServer) LetMeIn

func (this *RpcServer) LetMeIn(request *action.LeftMeInRequest, response *action.LeftMeInResponse) error

handle the join request, if this is the master node ,let it join and connect to server else send it master node ,let it talk to master

func (*RpcServer) StartSpider

func (this *RpcServer) StartSpider(request *action.DistributeRequest, response *action.DistributeReqponse) error

start spider for slave for now just start reporter

func (*RpcServer) StopNode

func (this *RpcServer) StopNode(request *action.StopRequest, response *action.StopResponse) error

Jump to

Keyboard shortcuts

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