Documentation
¶
Index ¶
- Constants
- Variables
- type RingBuffer
- func (r *RingBuffer) AlignBytes() []byte
- func (r *RingBuffer) Capacity() int
- func (r *RingBuffer) Forward(step, mode int) int
- func (r *RingBuffer) Free() int
- func (r *RingBuffer) Has() int
- func (r *RingBuffer) Peek2() (head, tail []byte)
- func (r *RingBuffer) PeekWrite(length int) []byte
- func (r *RingBuffer) Read(p *[]byte, length int, update bool) int
- func (r *RingBuffer) Reset()
- func (r *RingBuffer) Status() string
- func (r *RingBuffer) Truncate()
- func (r *RingBuffer) Update(buf []byte)
- func (r *RingBuffer) Write(p *[]byte, length int, update bool) int
Constants ¶
View Source
const ( OpRead = iota OpWrite )
Variables ¶
View Source
var RingBufferGuardByteSize = 8 * 1024 * 1024 //8MB
View Source
var RingBufferInitByteSize = 16 * 1024
RingBufferInitByteSize ...
View Source
var RingBufferLimitByteSize = 1024 * 1024
RingBufferLimitByteSize ...
Functions ¶
This section is empty.
Types ¶
type RingBuffer ¶
type RingBuffer struct {
// contains filtered or unexported fields
}
RingBuffer is a circular buffer
func NewRingBuffer ¶
func NewRingBuffer() *RingBuffer
NewRingBuffer returns a new RingBuffer whose buffer has the given size.
func (*RingBuffer) Peek2 ¶
func (r *RingBuffer) Peek2() (head, tail []byte)
Peek2 returns the readable bytes as up to two slices. The second slice is non-nil only when the data wraps around the end.
func (*RingBuffer) PeekWrite ¶
func (r *RingBuffer) PeekWrite(length int) []byte
PeekWrite returns a contiguous slice of writable bytes. The returned slice may be smaller than length if it would wrap around the end. After writing n bytes into the returned slice, call Forward(n, OpWrite).
func (*RingBuffer) Read ¶
func (r *RingBuffer) Read(p *[]byte, length int, update bool) int
Read ...
func (*RingBuffer) Reset ¶
func (r *RingBuffer) Reset()
Reset the read pointer and writer pointer to zero.
func (*RingBuffer) Status ¶
func (r *RingBuffer) Status() string
Click to show internal directories.
Click to hide internal directories.