memory

package
v0.32.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const Name = "memory"

Name is the stable identifier used in routing configuration.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// QueueSize is the per-subscription channel capacity. Defaults
	// to 1024 when zero or negative.
	QueueSize int
	// FullPolicy controls the action when QueueSize is reached.
	// Defaults to FullPolicyError when empty.
	FullPolicy FullPolicy
	// PublishTimeout caps Publish in the block-policy case. Zero
	// means no timeout.
	PublishTimeout time.Duration
}

Config configures a memory Transport instance.

func (Config) EffectiveFullPolicy

func (c Config) EffectiveFullPolicy() FullPolicy

EffectiveFullPolicy applies the default when FullPolicy is unset.

func (Config) EffectiveQueueSize

func (c Config) EffectiveQueueSize() int

EffectiveQueueSize applies the default when QueueSize is unset.

type FullPolicy

type FullPolicy string

FullPolicy controls what happens when a subscription queue is full.

const (
	// FullPolicyError rejects new publishes with ErrQueueFull. The
	// caller decides whether to retry or fail the upstream operation.
	// This is the default — it makes back-pressure explicit.
	FullPolicyError FullPolicy = "error"
	// FullPolicyBlock blocks the publisher until the queue drains.
	// Use only when the publisher can tolerate latency spikes.
	FullPolicyBlock FullPolicy = "block"
	// FullPolicyDropOldest evicts the oldest pending frame to make
	// room for the new one. Use for throwaway telemetry where loss
	// is preferable to either error or blocking.
	FullPolicyDropOldest FullPolicy = "drop_oldest"
)

Jump to

Keyboard shortcuts

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