MCPcopy Create free account
hub / github.com/coder/coder / evict

Method evict

agent/immortalstreams/backedpipe/ring_buffer.go:79–89  ·  view source on GitHub ↗

evict removes the specified number of bytes from the beginning of the buffer.

(count int)

Source from the content-addressed store, hash-verified

77
78// evict removes the specified number of bytes from the beginning of the buffer.
79func (rb *ringBuffer) evict(count int) {
80 if count >= rb.Size() {
81 // Evict everything
82 rb.start = 0
83 rb.end = -1
84 return
85 }
86
87 rb.start = (rb.start + count) % len(rb.buffer)
88 // Buffer remains non-empty after partial eviction
89}
90
91// ReadLast returns the last n bytes from the buffer.
92// If n is greater than the available data, returns an error.

Callers 1

WriteMethod · 0.95

Calls 1

SizeMethod · 0.95

Tested by

no test coverage detected