MCPcopy
hub / github.com/keploy/keploy / Load

Method Load

pkg/agent/hooks/linux/hooks.go:83–109  ·  view source on GitHub ↗
(ctx context.Context, opts agent.HookCfg, setupOpts config.Agent)

Source from the content-addressed store, hash-verified

81}
82
83func (h *Hooks) Load(ctx context.Context, opts agent.HookCfg, setupOpts config.Agent) error {
84
85 h.sess.Set(uint64(0), &agent.Session{
86 ID: uint64(0), // need to check this one
87 })
88 err := h.load(ctx, opts, setupOpts)
89 if err != nil {
90 return err
91 }
92
93 g, ok := ctx.Value(models.ErrGroupKey).(*errgroup.Group)
94 if !ok {
95 return errors.New("failed to get the error group from the context")
96 }
97
98 g.Go(func() error {
99 defer utils.Recover(h.logger)
100 <-ctx.Done()
101 h.unLoad(ctx, opts)
102
103 // deleting in order to free the memory on shutdown.
104 h.sess.Delete(uint64(0))
105 return nil
106 })
107
108 return nil
109}
110
111func (h *Hooks) load(ctx context.Context, opts agent.HookCfg, setupOpts config.Agent) error {
112 // Allow the current process to lock memory for eBPF resources.

Callers

nothing calls this directly

Calls 6

loadMethod · 0.95
unLoadMethod · 0.95
RecoverFunction · 0.92
NewMethod · 0.65
DeleteMethod · 0.65
SetMethod · 0.45

Tested by

no test coverage detected