peek returns the data from index and the number of bytes to encode the length of the data in uvarint format
(index int)
| 233 | |
| 234 | // peek returns the data from index and the number of bytes to encode the length of the data in uvarint format |
| 235 | func (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 |
| 246 | func (q *BytesQueue) canInsertAfterTail(need int) bool { |
no test coverage detected