qevent

package
v0.0.0-...-5d9f3d3 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package qevent implements a JSON-based event channel between guest and host.

Index

Constants

This section is empty.

Variables

View Source
var ErrEventChannelMissingDoneEvent = errors.New("never received the final event channel event (did you call Close() on the guest event channel emitter?)")

ErrEventChannelMissingDoneEvent is returned when the final event channel event is not received.

Functions

func EventChannel

func EventChannel[T any](name string, events chan<- T) qemu.Fn

EventChannel adds a virtio-serial-backed channel between host and guest to send JSON events (T).

Use guest.SerialEventChannel with the same name to get access to the emitter in the guest.

Guest events will be sent on the supplied channel. The channel will be closed when the guest exits or indicates that no more events are coming. If the guest exits without indicating that no more events are coming, the VM exit will return an error. (guest.SerialEventChannel.Close emits this "done" event.)

If the channel is blocking, guest event processing is blocked as well.

func EventChannelCallback

func EventChannelCallback[T any](name string, callback func(T)) qemu.Fn

EventChannelCallback adds a virtio-serial-backed channel between host and guest to send JSON events (T).

Use guest.SerialEventChannel with the same name to get access to the emitter in the guest.

When a guest event occurs, the callback is called.

func ReadFile

func ReadFile[T any](path string) ([]T, error)

ReadFile reads events from a file that was written to using guest.EventChannel.

Types

This section is empty.

Jump to

Keyboard shortcuts

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