MCPcopy Create free account
hub / github.com/CPChain/chain / Register

Method Register

node/node.go:116–125  ·  view source on GitHub ↗

Register injects a new service into the node's stack. The service created by the passed constructor must be unique in its type with regard to sibling ones.

(constructor ServiceConstructor)

Source from the content-addressed store, hash-verified

114// Register injects a new service into the node's stack. The service created by
115// the passed constructor must be unique in its type with regard to sibling ones.
116func (n *Node) Register(constructor ServiceConstructor) error {
117 n.lock.Lock()
118 defer n.lock.Unlock()
119
120 if n.server != nil {
121 return ErrNodeRunning
122 }
123 n.serviceFuncs = append(n.serviceFuncs, constructor)
124 return nil
125}
126
127// Start creates a p2p node and begins the service
128func (n *Node) Start() error {

Callers 13

registerChainServiceFunction · 0.45
initFunction · 0.45
TestContextServicesFunction · 0.45
ExampleServiceFunction · 0.45
TestServiceRegistryFunction · 0.45
TestServiceLifeCycleFunction · 0.45
TestServiceRestartsFunction · 0.45
TestServiceRetrievalFunction · 0.45
TestProtocolGatherFunction · 0.45

Calls 2

LockMethod · 0.80
UnlockMethod · 0.80

Tested by 12

initFunction · 0.36
TestContextServicesFunction · 0.36
ExampleServiceFunction · 0.36
TestServiceRegistryFunction · 0.36
TestServiceLifeCycleFunction · 0.36
TestServiceRestartsFunction · 0.36
TestServiceRetrievalFunction · 0.36
TestProtocolGatherFunction · 0.36
TestAPIGatherFunction · 0.36