MCPcopy Index your code
hub / github.com/docker/docker-agent / Drain

Method Drain

pkg/concurrent/buffer.go:54–60  ·  view source on GitHub ↗

Drain returns the buffered content and resets the buffer atomically.

()

Source from the content-addressed store, hash-verified

52
53// Drain returns the buffered content and resets the buffer atomically.
54func (b *Buffer) Drain() string {
55 b.mu.Lock()
56 defer b.mu.Unlock()
57 s := b.buf.String()
58 b.buf.Reset()
59 return s
60}

Callers 1

TestBuffer_DrainFunction · 0.95

Calls 4

ResetMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45
StringMethod · 0.45

Tested by 1

TestBuffer_DrainFunction · 0.76