transport

package
v2.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2025 License: BSD-3-Clause Imports: 2 Imported by: 2

Documentation

Overview

Package transport provides a registry and interfaces for output transports.

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrTransport is the base error for transport failures.
	ErrTransport = fmt.Errorf("transport error")
)

Functions

func GetTransports

func GetTransports() []string

GetTransports returns the list of registered transport names.

func RegisterTransportDriver

func RegisterTransportDriver(name string, t TransportDriver)

RegisterTransportDriver registers and prepares a transport under a name.

Types

type DriverTransportError

type DriverTransportError struct {
	Driver string
	Err    error
}

DriverTransportError wraps a driver-specific error with its transport name.

func (*DriverTransportError) Error

func (e *DriverTransportError) Error() string

func (*DriverTransportError) Unwrap

func (e *DriverTransportError) Unwrap() []error

type Transport

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

Transport is a named transport wrapper used by the registry.

func FindTransport

func FindTransport(name string) (*Transport, error)

FindTransport returns a configured transport by name.

func (*Transport) Close

func (t *Transport) Close() error

Close calls the driver Close and wraps errors with transport metadata.

func (*Transport) Send

func (t *Transport) Send(key, data []byte) error

Send forwards data to the driver and wraps errors with transport metadata.

type TransportDriver

type TransportDriver interface {
	Prepare() error              // Prepare driver (eg: flag registration)
	Init() error                 // Initialize driver (eg: start connections, open files...)
	Close() error                // Close driver (eg: close connections and files...)
	Send(key, data []byte) error // Send a formatted message
}

TransportDriver describes a transport plugin lifecycle and send method.

type TransportInterface

type TransportInterface interface {
	Send(key, data []byte) error
}

TransportInterface is the minimal interface needed to send payloads.

Directories

Path Synopsis
Package file implements a file/stdout transport.
Package file implements a file/stdout transport.
Package kafka implements a Kafka transport using sarama.
Package kafka implements a Kafka transport using sarama.

Jump to

Keyboard shortcuts

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