MCPcopy Create free account
hub / github.com/brimdata/super / marshalControl

Function marshalControl

api/queryio/client.go:76–93  ·  view source on GitHub ↗
(zctrl *sbuf.Control)

Source from the content-addressed store, hash-verified

74}
75
76func marshalControl(zctrl *sbuf.Control) (any, error) {
77 ctrl, ok := zctrl.Message.(*bsupio.Control)
78 if !ok {
79 return nil, fmt.Errorf("unknown control type: %T", zctrl.Message)
80 }
81 if ctrl.Format != bsupio.ControlFormatSUP {
82 return nil, fmt.Errorf("unsupported app encoding: %v", ctrl.Format)
83 }
84 value, err := sup.ParseValue(super.NewContext(), string(ctrl.Bytes))
85 if err != nil {
86 return nil, fmt.Errorf("unable to parse control message: %w (%s)", err, ctrl.Bytes)
87 }
88 var v any
89 if err := unmarshaler.Unmarshal(value, &v); err != nil {
90 return nil, fmt.Errorf("unable to unmarshal control message: %w (%s)", err, ctrl.Bytes)
91 }
92 return v, nil
93}

Callers 1

PullMethod · 0.85

Calls 3

ParseValueFunction · 0.92
NewContextFunction · 0.92
UnmarshalMethod · 0.45

Tested by

no test coverage detected