rationale behind `minimumHeaderSize` in `bytes_queue` package
- Dominant language
- Go
- Stars
- 8.2k
- Forks
- 614
- Avg merge
- 5d 12h
- Merged PRs (30d)
- 1
Description
To understand the issue take a look at this test:
```Go
func TestBytesQueue(t *testing.T) {
// given
queue := NewBytesQueue(10, 10, true)
// when
queue.Push([]byte("hello"))
queue.Push([]byte("m"))
queue.Pop()
_, err := queue.Push([]byte("o"))
if err != nil {
// test will fail here
// queueError{"Full queue. Maximum size limit reached."}
t.Fatal("Queue should have pushed `o`")
}
// then
// expected result
assertEqual(t, 2, queue.Len())
}
```
Clearly, the buffer has enough space to add `[]byte("o")`. Specifically, `canInsertBeforeHead` method should return true, but `minimumHeaderSize` prevents this to happen.
I am curious to know about the rationale behind `minimumHeaderSize` because as you saw it prevents testing/using this package intuitively.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.