MCPcopy Create free account
hub / github.com/koding/kite / ParseCallbacks

Function ParseCallbacks

dnode/callback.go:78–92  ·  view source on GitHub ↗

parseCallbacks parses the message's "callbacks" field and prepares callback functions in "arguments" field.

(msg *Message, sender func(id uint64, args []interface{}) error)

Source from the content-addressed store, hash-verified

76// parseCallbacks parses the message's "callbacks" field and prepares
77// callback functions in "arguments" field.
78func ParseCallbacks(msg *Message, sender func(id uint64, args []interface{}) error) error {
79 // Parse callbacks field and create callback functions.
80 for methodID, path := range msg.Callbacks {
81 id, err := strconv.ParseUint(methodID, 10, 64)
82 if err != nil {
83 return err
84 }
85
86 f := func(args ...interface{}) error { return sender(id, args) }
87 spec := CallbackSpec{path, Function{functionReceived(f)}}
88 msg.Arguments.CallbackSpecs = append(msg.Arguments.CallbackSpecs, spec)
89 }
90
91 return nil
92}

Callers

nothing calls this directly

Calls 1

functionReceivedFuncType · 0.85

Tested by

no test coverage detected