MCPcopy Create free account
hub / github.com/allegro/bigcache / Pop

Method Pop

queue/bytes_queue.go:163–183  ·  view source on GitHub ↗

Pop reads the oldest entry from queue and moves head pointer to the next one

()

Source from the content-addressed store, hash-verified

161
162// Pop reads the oldest entry from queue and moves head pointer to the next one
163func (q *BytesQueue) Pop() ([]byte, error) {
164 data, blockSize, err := q.peek(q.head)
165 if err != nil {
166 return nil, err
167 }
168
169 q.head += blockSize
170 q.count--
171
172 if q.head == q.rightMargin {
173 q.head = leftMarginIndex
174 if q.tail == q.rightMargin {
175 q.tail = leftMarginIndex
176 }
177 q.rightMargin = q.tail
178 }
179
180 q.full = false
181
182 return data, nil
183}
184
185// Peek reads the oldest entry from list without moving head pointer
186func (q *BytesQueue) Peek() ([]byte, error) {

Calls 1

peekMethod · 0.95