MCPcopy
hub / github.com/CodisLabs/codis / RemoveProxy

Method RemoveProxy

pkg/topom/topom_proxy.go:78–101  ·  view source on GitHub ↗
(token string, force bool)

Source from the content-addressed store, hash-verified

76}
77
78func (s *Topom) RemoveProxy(token string, force bool) error {
79 s.mu.Lock()
80 defer s.mu.Unlock()
81 ctx, err := s.newContext()
82 if err != nil {
83 return err
84 }
85
86 p, err := ctx.getProxy(token)
87 if err != nil {
88 return err
89 }
90 c := s.newProxyClient(p)
91
92 if err := c.Shutdown(); err != nil {
93 log.WarnErrorf(err, "proxy-[%s] shutdown failed, force remove = %t", token, force)
94 if !force {
95 return errors.Errorf("proxy-[%s] shutdown failed", p.Token)
96 }
97 }
98 defer s.dirtyProxyCache(p.Token)
99
100 return s.storeRemoveProxy(p)
101}
102
103func (s *Topom) ReinitProxy(token string) error {
104 s.mu.Lock()

Callers 4

TestRemoveProxyFunction · 0.45
TestApiProxyFunction · 0.45
MaintainsMethod · 0.45
handleProxyCommandMethod · 0.45

Calls 8

newContextMethod · 0.95
newProxyClientMethod · 0.95
dirtyProxyCacheMethod · 0.95
storeRemoveProxyMethod · 0.95
getProxyMethod · 0.80
WarnErrorfMethod · 0.80
ErrorfMethod · 0.80
ShutdownMethod · 0.45

Tested by 2

TestRemoveProxyFunction · 0.36
TestApiProxyFunction · 0.36