(workerIP string, m *rpc.MapInfo)
| 10 | ) |
| 11 | |
| 12 | func Map(workerIP string, m *rpc.MapInfo) bool { |
| 13 | conn, err := grpc.Dial(workerIP, grpc.WithInsecure()) |
| 14 | if err != nil { |
| 15 | log.Warn(err) |
| 16 | return false |
| 17 | } |
| 18 | defer conn.Close() |
| 19 | c := rpc.NewWorkerClient(conn) |
| 20 | |
| 21 | ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second) |
| 22 | defer cancel() |
| 23 | |
| 24 | r, err := c.Map(ctx, m) |
| 25 | if err != nil { |
| 26 | log.Warn("[Master]: " + err.Error()) |
| 27 | return false |
| 28 | } |
| 29 | return r.Result |
| 30 | } |
| 31 | |
| 32 | func Reduce(workerIP string, m *rpc.ReduceInfo) bool { |
| 33 | conn, err := grpc.Dial(workerIP, grpc.WithInsecure()) |
no test coverage detected