mock

package
v0.7.0 Latest Latest
Warning

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

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

Documentation

Overview

Package mock provides an in-process, CGo-free implementation of the dds interfaces. All participants within the same process share a global in-memory broker: a Publisher.Write on topic T is delivered synchronously to every Subscriber.C() for topic T.

The mock is the default implementation used by unit tests. Switch to the rtps or cyclone package when a real DDS domain (multi-process, multi-host) is required.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

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

New creates a mock DDS Participant for the given domain. Domain is accepted for API compatibility but has no effect — all mock participants share the same global broker regardless of domain.

Types

type Option added in v0.3.0

type Option func(*participant)

Option configures a mock participant.

func WithDeadlineCallback added in v0.3.0

func WithDeadlineCallback(fn func(topic string)) Option

WithDeadlineCallback registers fn to be called when a publisher has not written within its QoS.Deadline period.

func WithLivelinessCallback added in v0.4.0

func WithLivelinessCallback(fn func(dds.GUID, dds.LivelinessEvent)) Option

WithLivelinessCallback registers fn to be called when a participant is discovered or lost. In the mock, participants fire LivelinessGained on New and LivelinessLost on Close.

func WithLogger added in v0.4.0

func WithLogger(l *slog.Logger) Option

WithLogger sets the structured logger used by this participant. Log output is zero-cost when l is nil.

Jump to

Keyboard shortcuts

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