services

package
v0.39.0 Latest Latest
Warning

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

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

Documentation

Overview

Package services provides long-running operational service wrappers for go-DDS (Milestone 10 — Enterprise Services: Service Framework).

Three services are provided:

Each service follows the same lifecycle:

svc := services.NewXxx(p, opts)
if err := svc.Start(...); err != nil { ... }
// ... application runs ...
svc.Stop()

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MonitorService

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

MonitorService wraps monitor.Monitor as a managed service.

func NewMonitorService

func NewMonitorService(p dds.Participant, opts monitor.Options) (*MonitorService, error)

NewMonitorService creates and starts a MonitorService for participant p.

func (*MonitorService) Addr

func (s *MonitorService) Addr() string

Addr returns the TCP address the monitor HTTP server is listening on.

func (*MonitorService) Close

func (s *MonitorService) Close() error

Close shuts down the monitor HTTP server.

func (*MonitorService) Mon

func (s *MonitorService) Mon() *monitor.Monitor

Mon returns the underlying monitor.Monitor, allowing direct use of its Publish method for injecting dashboard events.

type RecorderOptions

type RecorderOptions struct {
	// Topics is the list of DDS topic names to record. Subscribing begins when
	// Start is called. Empty Topics results in a recorder that captures nothing.
	Topics []string
	// Output is the destination writer for the JSONL recording stream.
	// The caller retains ownership; RecorderService does not close it.
	Output io.Writer
}

RecorderOptions configures a RecorderService.

type RecorderService

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

RecorderService continuously records DDS samples from Topics to Output in JSONL format. It wraps record.Recorder and provides a managed Start/Stop lifecycle.

func NewRecorderService

func NewRecorderService(p dds.Participant, opts RecorderOptions) *RecorderService

NewRecorderService creates a RecorderService for participant p.

func (*RecorderService) Start

func (s *RecorderService) Start() error

Start subscribes to all configured topics and begins recording. It is safe to call Start only once; subsequent calls return nil without effect.

func (*RecorderService) Stop

func (s *RecorderService) Stop()

Stop halts recording and closes all subscribers. It is safe to call Stop multiple times.

type ReplayOptions

type ReplayOptions struct {
	// Input is the JSONL recording stream to replay. The caller retains
	// ownership; ReplayService does not close it.
	Input io.Reader
	// Speed is the playback speed multiplier (e.g. 2.0 = twice real-time).
	// 0 or negative values are clamped to 1.0 (real-time).
	Speed float64
	// Topics restricts replay to these topics. nil or empty = replay all.
	Topics []string
	// Loop, when true, restarts replay from the beginning when the recording ends.
	// The caller must pass a cancellable context to Stop replay via context cancellation.
	// Note: Loop requires Input to implement [io.Seeker].
	Loop bool
}

ReplayOptions configures a ReplayService.

type ReplayService

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

ReplayService replays a JSONL recording into DDS topics via a managed lifecycle. It wraps record.Player.

func NewReplayService

func NewReplayService(p dds.Participant, opts ReplayOptions) *ReplayService

NewReplayService creates a ReplayService for participant p.

func (*ReplayService) Done

func (s *ReplayService) Done() <-chan struct{}

Done returns a channel that is closed when the replay goroutine exits (either due to reaching the end of the recording, context cancellation, or Stop).

func (*ReplayService) Err

func (s *ReplayService) Err() error

Err returns the error from the last replay run, if any. Only meaningful after Stop has returned.

func (*ReplayService) Start

func (s *ReplayService) Start(ctx context.Context) error

Start begins replay in a background goroutine. The context ctx controls the replay; cancel it (or call Stop) to halt playback. Start may only be called once; subsequent calls return nil immediately.

func (*ReplayService) Stop

func (s *ReplayService) Stop()

Stop halts the replay. It blocks until the replay goroutine exits. Safe to call multiple times.

Jump to

Keyboard shortcuts

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