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

Method EndContainer

scode/builder.go:49–64  ·  view source on GitHub ↗

EndContainer closes the most recently opened container. It panics if the receiver has no open container.

()

Source from the content-addressed store, hash-verified

47// EndContainer closes the most recently opened container. It panics if the
48// receiver has no open container.
49func (b *Builder) EndContainer() {
50 // Pop the container body offset off the stack.
51 bodyOff := b.containers[len(b.containers)-1]
52 b.containers = b.containers[:len(b.containers)-1]
53 tag := toTag(len(b.bytes) - bodyOff)
54 tagSize := SizeOfUvarint(tag)
55 // BeginContainer allocated one byte for the container tag.
56 tagOff := bodyOff - 1
57 if tagSize > 1 {
58 // Need additional space for the tag, so move body over.
59 b.bytes = append(b.bytes[:tagOff+tagSize], b.bytes[bodyOff:]...)
60 }
61 if binary.PutUvarint(b.bytes[tagOff:], tag) != tagSize {
62 panic("bad container tag size")
63 }
64}
65
66func (b *Builder) EndContainerWithNones(nopts int, nones []int) {
67 if nopts == 0 {

Callers 15

TestNormalizeSetFunction · 0.95
TestValueValidateFunction · 0.95
TestBuilderFunction · 0.95
EndContainerWithNonesMethod · 0.95
BuildFusionFunction · 0.80
BuildUnionFunction · 0.80
AppendMethod · 0.80
SerializeMethod · 0.80
SerializeMethod · 0.80
SerializeMethod · 0.80
SerializeMethod · 0.80
SerializeMethod · 0.80

Implementers 15

DynamicBuildervector/builder.go
recordBuildervector/builder.go
arraySetBuildervector/builder.go
mapBuildervector/builder.go
unionBuildervector/builder.go
fusionBuildervector/builder.go
enumBuildervector/builder.go
intBuildervector/builder.go
uintBuildervector/builder.go
floatBuildervector/builder.go
boolBuildervector/builder.go
bytesStringTypeBuildervector/builder.go

Calls 2

toTagFunction · 0.85
SizeOfUvarintFunction · 0.85

Tested by 3

TestNormalizeSetFunction · 0.76
TestValueValidateFunction · 0.76
TestBuilderFunction · 0.76