MCPcopy Index your code
hub / github.com/koding/kite / register

Method register

dnode/scrub.go:123–143  ·  view source on GitHub ↗

register is called when a function/method is found in arguments array. It assigns an unique ID to the passed callback and stores it internally.

(cb func(*Partial), path Path, callbacks map[string]Path)

Source from the content-addressed store, hash-verified

121// register is called when a function/method is found in arguments array. It
122// assigns an unique ID to the passed callback and stores it internally.
123func (s *Scrubber) register(cb func(*Partial), path Path, callbacks map[string]Path) {
124 // do not register nil callbacks.
125 if cb == nil {
126 return
127 }
128 // subtract one to start counting from zero. This is not absolutely
129 // necessary, just cosmetics.
130 next := atomic.AddUint64(&s.seq, 1) - 1
131 seq := strconv.FormatUint(next, 10)
132
133 // save in scubber callbacks.
134 s.Lock()
135 s.callbacks[next] = cb
136 s.Unlock()
137
138 // Add to callback map to be sent to remote. Make a copy of path because it
139 // is reused in caller.
140 pathCopy := make(Path, len(path))
141 copy(pathCopy, path)
142 callbacks[seq] = pathCopy
143}

Callers 2

collectMethod · 0.95
methodsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected