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

Method peek

queue/bytes_queue.go:235–243  ·  view source on GitHub ↗

peek returns the data from index and the number of bytes to encode the length of the data in uvarint format

(index int)

Source from the content-addressed store, hash-verified

233
234// peek returns the data from index and the number of bytes to encode the length of the data in uvarint format
235func (q *BytesQueue) peek(index int) ([]byte, int, error) {
236 err := q.peekCheckErr(index)
237 if err != nil {
238 return nil, 0, err
239 }
240
241 blockSize, n := binary.Uvarint(q.array[index:])
242 return q.array[index+n : index+int(blockSize)], int(blockSize), nil
243}
244
245// canInsertAfterTail returns true if it's possible to insert an entry of size of need after the tail of the queue
246func (q *BytesQueue) canInsertAfterTail(need int) bool {

Callers 3

PopMethod · 0.95
PeekMethod · 0.95
GetMethod · 0.95

Calls 1

peekCheckErrMethod · 0.95

Tested by

no test coverage detected