Help us shape the future of Go! Take the 2026 Go Developer Survey

buffers

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

README

pkg/controller/buffers

Fixed buffer sizes for EventBus subscriptions.

Overview

pkg/events.EventBus.Subscribe(name, bufferSize) requires a fixed buffer size. This package provides two presets covering every controller subscription:

Constant Size Use for
buffers.Critical 100 Business-critical paths where drops would mean missed reconciliation work (reconciler, deployer, validator)
buffers.Observability 200 Lossy paths where occasional drops are acceptable (commentator, debug ring buffer)

Quick Start

import (
    "github.com/haproxy-haptic/HAPTIC/pkg/controller/buffers"
    busevents "github.com/haproxy-haptic/HAPTIC/pkg/events"
)

eventChan := bus.Subscribe("my-component", buffers.Critical)
debugChan := bus.Subscribe("debug-events", buffers.Observability)

pkg/events also exposes fixed-size tier constants (LowVolumeSubscriberBuffer = 10, StandardSubscriberBuffer = 50, HighVolumeSubscriberBuffer = 100, PublishingSubscriberBuffer = 200, DebugSubscriberBuffer = 1000) for components that wire their own sizes directly.

See Also

  • pkg/events — the bus that consumes these sizes

License

Apache-2.0 — see root LICENSE.

Documentation

Overview

Package buffers provides fixed buffer sizes for event subscriptions.

Index

Constants

View Source
const (
	// Critical is the buffer size for business-critical components that need
	// reliable delivery (reconciler, deployer, validator).
	Critical = 100

	// Observability is the buffer size for lossy observability components that
	// can tolerate larger buffers and occasional drops (commentator, debug ring
	// buffer). Metrics is NOT one of them: it accumulates deltas with no resync,
	// so a silent drop permanently corrupts gauges that back critical alerts.
	Observability = 200
)

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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