package eventchannel
import "gvisor.dev/gvisor/pkg/eventchannel"
Package eventchannel contains functionality for sending any protobuf message on a socketpair.
The wire format is a uvarint length followed by a binary protobuf.Any message.
Index ¶
- Variables
- func AddEmitter(e Emitter)
- func Emit(msg proto.Message) error
- func HaveEmitters() bool
- func LogEmit(msg proto.Message) error
- func ProcessAll(src io.Reader, filters []string, out *os.File) error
- type Emitter
Variables ¶
var DefaultEmitter = &multiEmitter{}
DefaultEmitter is the default emitter. Calls to Emit and AddEmitter are sent to this Emitter.
Functions ¶
func AddEmitter ¶
func AddEmitter(e Emitter)
AddEmitter is a helper method that calls DefaultEmitter.AddEmitter.
func Emit ¶
Emit is a helper method that calls DefaultEmitter.Emit.
func HaveEmitters ¶
func HaveEmitters() bool
HaveEmitters indicates if any emitters have been registered to the default emitter.
func LogEmit ¶
LogEmit is a helper method that calls DefaultEmitter.Emit. It also logs a warning message when an error occurs.
func ProcessAll ¶
ProcessAll reads, parses and displays all events from src. The events are displayed to out.
Types ¶
type Emitter ¶
type Emitter interface { // Emit writes a single eventchannel message to an emitter. Emit should // return hangup = true to indicate an emitter has "hung up" and no further // messages should be directed to it. Emit(msg proto.Message) (hangup bool, err error) // Close closes this emitter. Emit cannot be used after Close is called. Close() error }
Emitter emits a proto message.
func DebugEmitterFrom ¶
DebugEmitterFrom creates a new event channel emitter by wrapping an existing raw emitter.
func RateLimitedEmitterFrom ¶
RateLimitedEmitterFrom creates a new event channel emitter that wraps the existing emitter and enforces rate limits. The limits are imposed via a token bucket, with `maxRate` events per second, with burst size of `burst` events. See the golang.org/x/time/rate package and https://en.wikipedia.org/wiki/Token_bucket for more information about token buckets generally.
func SocketEmitter ¶
SocketEmitter creates a new event channel based on the given fd.
SocketEmitter takes ownership of fd.
Source Files ¶
event.go processor.go rate.go
- Version
- v0.0.0-20250605235530-a6711d1e1dc6 (latest)
- Published
- Jun 5, 2025
- Platform
- linux/amd64
- Imports
- 14 packages
- Last checked
- 4 hours ago –
Tools for package owners.