hedzr/go-ringbuf

当队列满时,再添加可以自动覆盖最旧的吗?

Closed this issue · 3 comments

跟着示例代码试了一下,当队列满时,再添加新元素,会直接返回队列已满的错误。
是否可以当队列满时,直接自动覆盖最旧的元素,而不是返回已满的错误呢?

可以尝试做一份,今晚看看是否可行,太复杂的话就只好暂且挂起

Added overlapped ring buffer impl, and deeper testing will be covered in recently days. The stable point was arrived, and the new version would be released.

An overlapped ring buffer will overwrite the existing head element in putting new elem but the ring buffer is full.

The original ring buffer of ourselves is to return a wrong state and stop putting action, see the ErrQueueFull.

The new overlapped ring buffer will be created by calling NewOverlappedRingBuffer().

Any issues are welcome.

Nice job!