event

package
v0.0.0-...-35feb9c Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event interface {
	GetCallbackID() int32
}

Event represents an internal Event.

type Stream

type Stream struct {
	// Program specifies the source of the events - libvirt or QEMU.
	Program uint32

	// CallbackID is returned by the event registration call.
	CallbackID int32
	// contains filtered or unexported fields
}

Stream is an unbounded buffered event channel. The implementation consists of a pair of unbuffered channels and a goroutine to manage them. Client behavior will not cause incoming events to block.

func NewStream

func NewStream(program uint32, cbID int32) *Stream

NewStream configures a new Event Stream. Incoming events are appended to a queue, which is then relayed to the listening client. Client behavior will not cause incoming events to block. It is the responsibility of the caller to terminate the Stream via Shutdown() when no longer in use.

func (*Stream) Len

func (s *Stream) Len() int

Len will return the current count of events in the internal queue for a stream. It does this by sending a message to the stream's process() loop, which will then write the current length to the channel contained in that message.

func (*Stream) Push

func (s *Stream) Push(e Event)

Push appends a new event to the queue.

func (*Stream) Recv

func (s *Stream) Recv() chan Event

Recv returns the next available event from the Stream's queue.

func (*Stream) Shutdown

func (s *Stream) Shutdown()

Shutdown gracefully terminates Stream processing, releasing all internal resources. Events which have not yet been received by the client will be dropped. Subsequent calls to Shutdown() are idempotent.

Jump to

Keyboard shortcuts

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