ringbuffer

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2024 License: NIST-PD-fallback Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RingBuffer

type RingBuffer struct {
	// contains filtered or unexported fields
}

RingBuffer describes the shared-memory ring buffer filled by DEED.

func NewRingBuffer

func NewRingBuffer(rawName, descName string) (rb *RingBuffer, err error)

NewRingBuffer creates and returns a new RingBuffer object

func (*RingBuffer) BytesReadable

func (rb *RingBuffer) BytesReadable() int

BytesReadable tells how many bytes can be read. Actual answer may be larger, if writing is underway.

func (*RingBuffer) BytesWriteable

func (rb *RingBuffer) BytesWriteable() int

BytesWriteable tells how many bytes can be written. Actual answer may be larger, if reading is underway.

func (*RingBuffer) Close

func (rb *RingBuffer) Close() (err error)

Close closes the ring buffer by munmap and closing the shared memory regions.

func (*RingBuffer) Create

func (rb *RingBuffer) Create(bufsize int) (err error)

Create makes a writeable buffer. Though exported, it's only for testing.

func (*RingBuffer) DiscardAll

func (rb *RingBuffer) DiscardAll() (err error)

DiscardAll removes all readable bytes, which empties the buffer.

func (*RingBuffer) DiscardStride

func (rb *RingBuffer) DiscardStride(stride uint64) (err error)

DiscardStride removes readable bytes up to a multiple of stride. This empties the buffer except for a runt section with size less than stride bytes long

func (*RingBuffer) Open

func (rb *RingBuffer) Open() (err error)

Open opens the ring buffer shared memory regions and memory maps them.

func (*RingBuffer) PacketSize

func (rb *RingBuffer) PacketSize() (int64, error)

PacketSize returns the packetSize held in the buffer description

func (*RingBuffer) Read

func (rb *RingBuffer) Read(size int) (data []byte, err error)

Read reads a byte slice from the buffer of size no larger than size. It is not an error to request more bytes than the buffer could hold.

func (*RingBuffer) ReadAll

func (rb *RingBuffer) ReadAll() (data []byte, err error)

ReadAll reads all the bytes available in the buffer.

func (*RingBuffer) ReadMinimum

func (rb *RingBuffer) ReadMinimum(minimum int) (data []byte, err error)

ReadMinimum blocks until it can read at least minimum bytes. It does this by sleeping in 1 ms units

func (*RingBuffer) ReadMultipleOf

func (rb *RingBuffer) ReadMultipleOf(chunksize int) (data []byte, err error)

ReadMultipleOf will return a multiple (possibly 0) of chunksize bytes.

func (rb *RingBuffer) Unlink() (err error)

Unlink removes a writeable buffer's shared memory regions.

func (*RingBuffer) Write

func (rb *RingBuffer) Write(data []byte) (written int, err error)

Write adds data bytes to the buffer. Though exported, it's only for testing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL