QoS Cheatsheet
Quick reference for HDDS QoS policies and the fluent builder API.
Data Distribution
| Policy | Values | Default | Compatibility |
|---|---|---|---|
| Reliability | best_effort(), reliable() | best_effort | Exact match |
| History | keep_last(N), keep_all() | keep_last(100) | N/A |
| Durability | volatile(), transient_local(), persistent() | volatile | Writer ≥ Reader |
| ResourceLimits | max_samples, max_instances, max_quota_bytes | Unlimited | N/A |
Timing
| Policy | Values | Default | Compatibility |
|---|---|---|---|
| Deadline | deadline(Duration) | Infinite | Writer ≤ Reader |
| Lifespan | lifespan_secs(N), lifespan_millis(N) | Infinite | Writer ≥ Reader |
| LatencyBudget | latency_budget_millis(N), latency_budget_secs(N) | Zero | Hint (no check) |
| TimeBasedFilter | time_based_filter_millis(N), time_based_filter_secs(N) | Zero (disabled) | N/A (reader-only) |
| TransportPriority | transport_priority(N), transport_priority_high(), transport_priority_low() | 0 (normal) | Hint (no check) |
Ownership
| Policy | Values | Default | Compatibility |
|---|---|---|---|
| Ownership | ownership_shared(), ownership_exclusive() | Shared | Exact match |
| OwnershipStrength | ownership_strength(N), ownership_strength_high(), ownership_strength_low() | 0 | N/A (writer-only) |
Partition
| Policy | Values | Default | Compatibility |
|---|---|---|---|
| Partition | partition_single(name), partition(Partition) | Default (empty) | Intersection |
Lifecycle
| Policy | Values | Default | Compatibility |
|---|---|---|---|
| Liveliness | liveliness_automatic(), liveliness_manual_by_participant(), liveliness_manual_by_topic() | Automatic | Writer ≥ Reader |
Common Profiles
Sensor Streaming (High Rate)
use hdds::QoS;
let qos = QoS::best_effort().keep_last(1).volatile();
State Synchronization
use hdds::QoS;
let qos = QoS::reliable().keep_last(10).transient_local();
Command Queue
use hdds::QoS;
let qos = QoS::reliable().keep_all();
Event Log
use hdds::QoS;
let qos = QoS::reliable().keep_all().persistent();
Time-Sensitive Data (Expiring)
use hdds::QoS;
let qos = QoS::reliable().transient_local().lifespan_secs(5);
Priority Alarm System
use hdds::QoS;
let qos = QoS::reliable().transport_priority(10);
Primary/Backup Failover
use hdds::QoS;
// Primary writer
let primary_qos = QoS::reliable().ownership_exclusive().ownership_strength(200);
// Backup writer
let backup_qos = QoS::reliable().ownership_exclusive().ownership_strength(100);
Partitioned Multi-Tenant
use hdds::QoS;
let qos = QoS::reliable().partition_single("tenant_a");
Downsampled Reader
use hdds::QoS;
// Reader accepts one sample every 500ms from a high-frequency publisher
let qos = QoS::best_effort().time_based_filter_millis(500);
Full Example
use hdds::{Participant, QoS, TransportMode};
let participant = Participant::builder("example_app")
.domain_id(0)
.with_transport(TransportMode::UdpMulticast)
.build()?;
let topic = participant.topic::<SensorData>("sensors/data")?;
// Writer with reliable QoS
let writer = topic
.writer()
.qos(QoS::reliable().keep_last(100).transient_local())
.build()?;
// Reader with reliable QoS
let reader = topic
.reader()
.qos(QoS::reliable().keep_last(50))
.build()?;
Compatibility Matrix
Reliability
| Writer | Reader | Match |
|---|---|---|
| reliable() | reliable() | Yes |
| reliable() | best_effort() | Yes |
| best_effort() | best_effort() | Yes |
| best_effort() | reliable() | No |
Durability
| Writer | Reader | Match |
|---|---|---|
| persistent() | Any | Yes |
| transient_local() | transient_local()/volatile() | Yes |
| transient_local() | persistent() | No |
| volatile() | volatile() | Yes |
| volatile() | transient_local()/persistent() | No |
Liveliness
| Writer | Reader | Match |
|---|---|---|
| manual_by_topic | Any | Yes |
| manual_by_participant | manual_by_participant/automatic | Yes |
| manual_by_participant | manual_by_topic | No |
| automatic | automatic | Yes |
| automatic | manual_* | No |
Ownership
| Writer | Reader | Match |
|---|---|---|
| shared | shared | Yes |
| exclusive | exclusive | Yes |
| shared | exclusive | No |
| exclusive | shared | No |
Lifespan
| Writer | Reader | Match |
|---|---|---|
| 10s | 5s | Yes |
| 5s | 5s | Yes |
| 5s | 10s | No |
| Infinite | Any | Yes |
| Finite | Infinite | No |
Partition
| Writer | Reader | Match |
|---|---|---|
| ["A"] | ["A"] | Yes |
| ["A"] | ["B"] | No |
| ["A","B"] | ["B"] | Yes |
| [] (default) | [] (default) | Yes |
| ["A"] | [] (default) | No |
Fluent Builder API
Available Methods
| Method | Description |
|---|---|
QoS::reliable() | Guaranteed delivery with ACK/NACK |
QoS::best_effort() | Fire and forget, lowest latency |
.keep_last(n) | Keep last N samples per instance |
.keep_all() | Keep all samples (bounded by ResourceLimits) |
.volatile() | No persistence |
.transient_local() | In-memory cache for late joiners |
.persistent() | Disk persistence |
.deadline(Duration) | Maximum time between samples |
.lifespan_secs(n) | Data expiration in seconds |
.lifespan_millis(n) | Data expiration in milliseconds |
.latency_budget_millis(n) | Delivery latency hint in milliseconds |
.latency_budget_secs(n) | Delivery latency hint in seconds |
.time_based_filter_millis(n) | Reader-side minimum separation in milliseconds |
.time_based_filter_secs(n) | Reader-side minimum separation in seconds |
.transport_priority(n) | Network priority value (higher = more important) |
.transport_priority_high() | High network priority (value: 50) |
.transport_priority_low() | Low network priority (value: -50) |
.transport_priority_normal() | Normal network priority (value: 0) |
.ownership_shared() | Multiple writers allowed (default) |
.ownership_exclusive() | Highest-strength writer wins |
.ownership_strength(n) | Writer priority for exclusive ownership |
.ownership_strength_high() | High ownership priority (value: 100) |
.ownership_strength_low() | Low ownership priority (value: -100) |
.partition_single(name) | Set single partition name |
.partition(Partition) | Set custom partition with multiple names |
.liveliness_automatic(Duration) | DDS manages liveness assertions |
.liveliness_manual_by_participant(Duration) | Application asserts per participant |
.liveliness_manual_by_topic(Duration) | Application asserts per writer |