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

Function loadPlugin

worker/mainInterface.go:48–68  ·  view source on GitHub ↗

load the application Map and Reduce functions from a plugin file, e.g. .so files

(filename string)

Source from the content-addressed store, hash-verified

46// from a plugin file, e.g. .so files
47//
48func loadPlugin(filename string) (func(string, string, MrContext), func(string, []string, MrContext)) {
49 if _, err := os.Stat(filename); os.IsNotExist(err) {
50 log.Panic(err)
51 }
52 p, err := plugin.Open(filename)
53 if err != nil {
54 log.Panic(err)
55 }
56 xmapf, err := p.Lookup("Map")
57 if err != nil {
58 log.Panic(err)
59 }
60 mapf := xmapf.(func(string, string, MrContext))
61 xreducef, err := p.Lookup("Reduce")
62 if err != nil {
63 log.Panic(err)
64 }
65 reducef := xreducef.(func(string, []string, MrContext))
66
67 return mapf, reducef
68}

Callers 1

StartWorkerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected