transport

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	ID     string
	In     chan *Message
	Out    chan *Message
	Ctx    context.Context
	Cancel context.CancelFunc
}

Channel is a transport-agnostic processing context. One Channel services one request (sync HTTP) or many messages (future batch).

Channel direction: In and Out are sized from the pipeline's perspective. The pipeline READS from In and WRITES to Out. The transport adapter writes inbound payloads to In and reads response payloads from Out.

func NewChannel

func NewChannel(parent context.Context, id string, inBuf, outBuf int) *Channel

NewChannel constructs a Channel with caller-controlled buffer sizes. inBuf is typically 1 (one inbound message per sync request); outBuf should be large enough to absorb streaming chunks without blocking the upstream reader (e.g., 64).

The Channel takes ownership of its Ctx; callers should defer Cancel to release resources.

type Message

type Message struct {
	ID          string
	ParentID    string
	Body        []byte
	Headers     map[string]string
	Labels      map[string]string
	Attribution map[string]string
	ReceivedAt  time.Time
}

Message is the canonical packet that flows through Relay. It is transport-agnostic and payload-type-agnostic. There are NO transport flags (no Stream, no protocol field) and NO payload-shape flags (no Model, no provider-specific field). Anything OpenAI-shape or Ollama-shape is extracted by handlers from Body into locals.

Jump to

Keyboard shortcuts

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