(w *rpc.WorkerInfo)
| 11 | ) |
| 12 | |
| 13 | func WorkerRegister(w *rpc.WorkerInfo) int { |
| 14 | conn, err := grpc.Dial(MasterIP, grpc.WithInsecure()) |
| 15 | if err != nil { |
| 16 | panic(err) |
| 17 | } |
| 18 | defer conn.Close() |
| 19 | c := rpc.NewMasterClient(conn) |
| 20 | log.Trace("New Master Client") |
| 21 | |
| 22 | ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) |
| 23 | log.Trace("With Time out") |
| 24 | defer cancel() |
| 25 | |
| 26 | log.Trace("Start RPC call") |
| 27 | r, err := c.WorkerRegister(ctx, w) |
| 28 | log.Trace("End RPC call") |
| 29 | if err != nil { |
| 30 | panic(err) |
| 31 | } |
| 32 | |
| 33 | if r.Result == false { |
| 34 | panic("Register Error") |
| 35 | } |
| 36 | |
| 37 | return int(r.Id) |
| 38 | } |
| 39 | |
| 40 | func UpdateIMDInfo(u *rpc.IMDInfo) bool { |
| 41 | conn, err := grpc.Dial(MasterIP, grpc.WithInsecure()) |
no test coverage detected