MCPcopy Create free account
hub / github.com/google/gapid / Decode

Function Decode

gapil/bapi/decode.go:172–196  ·  view source on GitHub ↗

Decode deserializes the APIs from data.

(data []byte)

Source from the content-addressed store, hash-verified

170
171// Decode deserializes the APIs from data.
172func Decode(data []byte) ([]*semantic.API, *semantic.Mappings, error) {
173 d := decoder{}
174 if err := proto.Unmarshal(data, &d.content); err != nil {
175 return nil, nil, err
176 }
177 d.inst.build(d.content.Instances)
178
179 apis := make([]*semantic.API, len(d.content.Apis))
180 for i, id := range d.content.Apis {
181 apis[i] = d.api(id)
182 if d.err != nil {
183 return nil, nil, d.err
184 }
185 }
186
187 mappings := d.mappings()
188 if d.err != nil {
189 return nil, nil, d.err
190 }
191
192 for _, s := range d.toSort {
193 s.SortMembers()
194 }
195 return apis, mappings, nil
196}
197
198func (d *decoder) mappings() *semantic.Mappings {
199 out := semantic.Mappings{}

Callers

nothing calls this directly

Calls 5

apiMethod · 0.95
mappingsMethod · 0.95
UnmarshalMethod · 0.80
buildMethod · 0.65
SortMembersMethod · 0.65

Tested by

no test coverage detected