MCPcopy
hub / github.com/spacecloud-io/space-cloud / newModule

Function newModule

gateway/modules/module.go:36–79  ·  view source on GitHub ↗
(projectID, clusterID, nodeID string, managers *managers.Managers, globalMods *global.Global)

Source from the content-addressed store, hash-verified

34}
35
36func newModule(projectID, clusterID, nodeID string, managers *managers.Managers, globalMods *global.Global) (*Module, error) {
37 // Get managers
38 adminMan := managers.Admin()
39 syncMan := managers.Sync()
40 integrationMan := managers.Integration()
41
42 // Get global mods
43 metrics := globalMods.Metrics()
44
45 c := crud.Init()
46 c.SetAdminManager(adminMan)
47 c.SetGetSecrets(syncMan.GetSecrets)
48 c.SetIntegrationManager(integrationMan)
49 c.SetCachingModule(globalMods.Caching())
50
51 s := schema.Init(clusterID, c)
52
53 a := auth.Init(clusterID, nodeID, c, adminMan, integrationMan)
54 a.SetMakeHTTPRequest(syncMan.MakeHTTPRequest)
55
56 fn := functions.Init(clusterID, a, syncMan, integrationMan, metrics.AddFunctionOperation)
57 fn.SetCachingModule(globalMods.Caching())
58 f := filestore.Init(a, metrics.AddFileOperation)
59 f.SetGetSecrets(syncMan.GetSecrets)
60
61 e, err := eventing.New(clusterID, projectID, nodeID, a, c, syncMan, f, metrics.AddEventingType)
62 if err != nil {
63 return nil, err
64 }
65
66 f.SetEventingModule(e)
67
68 c.SetHooks(metrics.AddDBOperation)
69
70 rt, err := realtime.Init(projectID, nodeID, e, a, c, s, metrics, syncMan)
71 if err != nil {
72 return nil, err
73 }
74
75 u := userman.Init(c, a)
76 graphqlMan := graphql.New(a, c, fn, s)
77
78 return &Module{auth: a, db: c, user: u, file: f, functions: fn, realtime: rt, eventing: e, graphql: graphqlMan, schema: s, Managers: managers, GlobalMods: globalMods}, nil
79}

Callers 1

newModuleMethod · 0.85

Calls 12

AdminMethod · 0.80
SyncMethod · 0.80
IntegrationMethod · 0.80
MetricsMethod · 0.80
SetAdminManagerMethod · 0.80
SetIntegrationManagerMethod · 0.80
SetMakeHTTPRequestMethod · 0.80
SetEventingModuleMethod · 0.80
SetHooksMethod · 0.80
CachingMethod · 0.65
SetGetSecretsMethod · 0.45
SetCachingModuleMethod · 0.45

Tested by

no test coverage detected