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

Function Map

master/rpcClient.go:12–30  ·  view source on GitHub ↗
(workerIP string, m *rpc.MapInfo)

Source from the content-addressed store, hash-verified

10)
11
12func 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
32func Reduce(workerIP string, m *rpc.ReduceInfo) bool {
33 conn, err := grpc.Dial(workerIP, grpc.WithInsecure())

Callers 1

distributeMapTaskMethod · 0.70

Calls 2

MapMethod · 0.95
NewWorkerClientFunction · 0.92

Tested by

no test coverage detected