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

Method read

sio/bsupio/parser.go:37–73  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35}
36
37func (p *parser) read() (frame, error) {
38 for {
39 version, err := p.peeker.ReadByte()
40 if err != nil {
41 return frame{}, err
42 }
43 if version == EOS {
44 // At EOS, we create a new Decoder which clears out the types slice
45 // mapping the local type IDs to the shared-context types. Any data
46 // batches concurrently being decoded by a worker will still point
47 // to the old types slice so all continues on just fine as
48 // everything gets properly mappped to the shared context
49 // under concurrent locking in the target super.Context.
50 p.types = NewDecoder(p.types.sctx)
51 continue
52 }
53 if err := CheckVersion(version); err != nil {
54 return frame{}, err
55 }
56 code, err := p.peeker.ReadByte()
57 if err != nil {
58 return frame{}, err
59 }
60 switch typ := (code >> 4) & 3; typ {
61 case TypesFrame:
62 if err := p.decodeTypes(code); err != nil {
63 return frame{}, err
64 }
65 case ValuesFrame:
66 return p.decodeValues(code)
67 case ControlFrame:
68 return frame{}, p.decodeControl(code)
69 default:
70 return frame{}, fmt.Errorf("unknown BSUP message frame type: %d", typ)
71 }
72 }
73}
74
75func (p *parser) decodeTypes(code byte) error {
76 if (code & 0x40) != 0 {

Callers 5

__get_auth_tokenMethod · 0.45
startMethod · 0.45
decodeValMethod · 0.45
readCountedStringMethod · 0.45
PullMethod · 0.45

Calls 6

decodeTypesMethod · 0.95
decodeValuesMethod · 0.95
decodeControlMethod · 0.95
NewDecoderFunction · 0.85
CheckVersionFunction · 0.85
ReadByteMethod · 0.45

Tested by

no test coverage detected