MCPcopy Index your code
hub / github.com/coder/coder / tailBytes

Method tailBytes

agent/agentproc/headtail.go:146–159  ·  view source on GitHub ↗

tailBytes returns the current tail contents in order. The caller must hold b.mu.

()

Source from the content-addressed store, hash-verified

144// tailBytes returns the current tail contents in order. The
145// caller must hold b.mu.
146func (b *HeadTailBuffer) tailBytes() []byte {
147 if b.tail == nil {
148 return nil
149 }
150 if !b.tailFull {
151 // Haven't wrapped yet; data is [0, tailPos).
152 return b.tail[:b.tailPos]
153 }
154 // Wrapped: data is [tailPos, maxTail) + [0, tailPos).
155 out := make([]byte, b.maxTail)
156 n := copy(out, b.tail[b.tailPos:])
157 copy(out[n:], b.tail[:b.tailPos])
158 return out
159}
160
161// Bytes returns a copy of the raw buffer contents. If no
162// truncation has occurred the full output is returned;

Callers 2

BytesMethod · 0.95
OutputMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected