memory

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package memory provides an in-memory transport for testing and stress testing. It implements transport.Transport using channels only (no WebRTC). Callers push frames via SendInput and read pipeline output via Out().

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Transport

type Transport struct {
	// contains filtered or unexported fields
}

Transport is an in-memory transport that satisfies transport.Transport. Use SendInput to push frames into the pipeline; use Out() to read frames from the pipeline.

func NewTransport

func NewTransport() *Transport

NewTransport creates a new in-memory transport with buffered channels (default 128).

func NewTransportWithBuffer

func NewTransportWithBuffer(buf int) *Transport

NewTransportWithBuffer creates a new in-memory transport with the given buffer size per channel.

func (*Transport) Close

func (t *Transport) Close() error

Close closes the transport. It closes the input channel so the runner's input goroutine exits, but does not close the output channel to avoid panics from in-flight pipeline sends (sink may still be sending when the runner exits).

func (*Transport) Input

func (t *Transport) Input() <-chan frames.Frame

Input returns the channel of frames that the pipeline consumes (runner reads from this).

func (*Transport) Out

func (t *Transport) Out() <-chan frames.Frame

Out returns the output channel for reading pipeline results (e.g. TTSAudioRawFrame). The test receives from this channel to consume frames the pipeline sends to the client.

func (*Transport) Output

func (t *Transport) Output() chan<- frames.Frame

Output returns the channel the pipeline writes to (sink sends TTS and other frames here).

func (*Transport) SendInput

func (t *Transport) SendInput(ctx context.Context, f frames.Frame) bool

SendInput sends a frame into the pipeline input. It blocks until the frame is received or the transport is closed. Use from stress test / test code to simulate client input.

func (*Transport) Start

func (t *Transport) Start(ctx context.Context) error

Start implements transport.Transport. It returns immediately (no network setup).

Jump to

Keyboard shortcuts

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