MCPcopy Create free account
hub / github.com/BWbwchen/MapReduce / Reduce

Function Reduce

master/rpcClient.go:32–50  ·  view source on GitHub ↗
(workerIP string, m *rpc.ReduceInfo)

Source from the content-addressed store, hash-verified

30}
31
32func Reduce(workerIP string, m *rpc.ReduceInfo) bool {
33 conn, err := grpc.Dial(workerIP, grpc.WithInsecure())
34 if err != nil {
35 log.Warn(err)
36 return false
37 }
38 defer conn.Close()
39 c := rpc.NewWorkerClient(conn)
40
41 ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
42 defer cancel()
43
44 r, err := c.Reduce(ctx, m)
45 if err != nil {
46 log.Warn("[Master]: " + err.Error())
47 return false
48 }
49 return r.Result
50}
51
52func End(workerIP string) bool {
53 conn, err := grpc.Dial(workerIP, grpc.WithInsecure())

Callers 1

distributeReduceTaskMethod · 0.70

Calls 2

ReduceMethod · 0.95
NewWorkerClientFunction · 0.92

Tested by

no test coverage detected