MCPcopy Create free account
hub / github.com/coder/agentapi / Add

Method Add

lib/screentracker/ringbuffer.go:22–28  ·  view source on GitHub ↗

Add adds an item to the ring buffer

(item T)

Source from the content-addressed store, hash-verified

20
21// Add adds an item to the ring buffer
22func (r *RingBuffer[T]) Add(item T) {
23 r.items[r.nextIndex] = item
24 r.nextIndex = (r.nextIndex + 1) % len(r.items)
25 if r.count < len(r.items) {
26 r.count++
27 }
28}
29
30// GetAll returns all items in the buffer, oldest first
31func (b *RingBuffer[T]) GetAll() []T {

Callers 4

advanceForFunction · 0.80
snapshotLockedMethod · 0.80
TestEventEmitterFunction · 0.80
setupFunction · 0.80

Calls

no outgoing calls

Tested by 3

advanceForFunction · 0.64
TestEventEmitterFunction · 0.64
setupFunction · 0.64