transport

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: LGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package transport provides internal transport utilities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TimeoutRetry

func TimeoutRetry[T any](timeout time.Duration, operation RetryOperation[T]) (T, error)

TimeoutRetry executes an operation with timeout-based retry logic Common pattern for polling operations (like waiting for device ready)

func WithRetry

func WithRetry[T any](config RetryConfig, operation RetryOperation[T]) (T, error)

WithRetry executes an operation with retry logic This consolidates the common retry pattern used across transports

Types

type RetryConfig

type RetryConfig struct {
	OnRetry       func() error
	OnRetryFailed func() error
	Description   string
	MaxRetries    int
	RetryDelay    time.Duration
}

RetryConfig configures retry behavior

type RetryOperation

type RetryOperation[T any] func() (T, bool, error)

RetryOperation represents a function that can be retried Returns: data, shouldRetry, error - data: the result if successful - shouldRetry: true if the operation should be retried - error: any permanent error that should stop retries

Jump to

Keyboard shortcuts

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