auto

package
v0.50.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package auto provides automatic DDS transport selection. It picks the best available transport for a given domain at participant creation time:

  • TransportAuto (default): try shmem first; if unavailable or disabled, fall back to RTPS/UDP.
  • TransportShmem: use shared-memory transport only; error if unavailable.
  • TransportRTPS: use RTPS/UDP transport unconditionally; skip shmem.

Usage:

p, err := auto.NewParticipant(dds.Domain(0))
// shmem on same host, rtps when shmem is unavailable

p, err := auto.NewParticipant(dds.Domain(0), auto.WithTransport(auto.TransportRTPS))
// always RTPS, e.g. for cross-host deployments

The returned participant satisfies dds.Participant and may optionally implement dds.MetricsProvider, dds.DiscoveryMetricsProvider, and dds.HealthProvider depending on the selected backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewParticipant

func NewParticipant(domain dds.Domain, opts ...Option) (dds.Participant, error)

NewParticipant creates a DDS participant on domain using the best available transport. The selection algorithm is determined by the WithTransport option (default: TransportAuto).

The returned participant satisfies dds.Participant. Callers can type-assert to dds.HealthProvider, dds.MetricsProvider, etc. depending on the backend.

Types

type Option

type Option func(*cfg)

Option configures the automatic transport selection.

func WithRTPSOpts

func WithRTPSOpts(opts ...rtps.Option) Option

WithRTPSOpts passes additional options to the RTPS participant when the RTPS transport is selected (either directly or as the auto fallback).

func WithTransport

func WithTransport(t Transport) Option

WithTransport overrides the default transport preference.

type Transport

type Transport int

Transport identifies which DDS transport to use.

const (
	// TransportAuto tries shmem first and falls back to RTPS/UDP if shmem is
	// unavailable. This is the default.
	TransportAuto Transport = iota
	// TransportShmem uses shared memory only. Returns an error if shmem cannot
	// be initialised (e.g. filesystem permissions, unsupported OS).
	TransportShmem
	// TransportRTPS always uses the RTPS/UDP transport regardless of whether
	// shmem is available. Use this for cross-host deployments.
	TransportRTPS
)

func (Transport) String

func (t Transport) String() string

String returns a human-readable transport name.

Jump to

Keyboard shortcuts

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