Documentation ¶
Index ¶
- Constants
- type RpcClient
- func (this *RpcClient) Connect(ip string, port int) error
- func (this *RpcClient) Detect()
- func (this *RpcClient) Dial(ip string, port int) (*rpc.Client, error)
- func (this *RpcClient) Distribute(nodeName string, request *http.Request) error
- func (this *RpcClient) LetMeIn(ip string, port int) error
- func (this *RpcClient) ReportResult(nodeName string, result *crawler.ScrapeResult) error
- func (this *RpcClient) Start()
- func (this *RpcClient) StartSpider(nodeName, spiderName string) error
- func (this *RpcClient) StopNode(nodeName string) error
- func (this *RpcClient) SyncClusterInfo()
- type RpcServer
- func (this *RpcServer) AcceptRequest(request *action.DistributeRequest, response *action.DistributeReqponse) error
- func (this *RpcServer) AcceptResult(request *action.ReportRequest, response *action.ReportResponse) error
- func (this *RpcServer) Connect(request *action.RpcBase, response *action.RpcBase) error
- func (this *RpcServer) IsAlive(request *action.RpcBase, response *action.RpcBase) error
- func (this *RpcServer) LetMeIn(request *action.LeftMeInRequest, response *action.LeftMeInResponse) error
- func (this *RpcServer) StartSpider(request *action.DistributeRequest, response *action.DistributeReqponse) error
- func (this *RpcServer) StopNode(request *action.StopRequest, response *action.StopResponse) error
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 (*RpcClient) Distribute ¶
* this is rpc method of request *
func (*RpcClient) ReportResult ¶
func (this *RpcClient) ReportResult(nodeName string, result *crawler.ScrapeResult) error
for slave send crawl result to master
func (*RpcClient) StartSpider ¶
func (*RpcClient) SyncClusterInfo ¶
func (this *RpcClient) SyncClusterInfo()
type RpcServer ¶
type RpcServer struct {
// contains filtered or unexported fields
}
func NewRpcServer ¶
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) 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
Click to show internal directories.
Click to hide internal directories.