Aller au contenu principal

QoS Cheatsheet

Quick reference for HDDS QoS policies and the fluent builder API.

Data Distribution

PolicyValuesDefaultCompatibility
Reliabilitybest_effort(), reliable()best_effortExact match
Historykeep_last(N), keep_all()keep_last(100)N/A
Durabilityvolatile(), transient_local(), persistent()volatileWriter ≥ Reader
ResourceLimitsmax_samples, max_instances, max_quota_bytesUnlimitedN/A

Timing

PolicyValuesDefaultCompatibility
Deadlinedeadline(Duration)InfiniteWriter ≤ Reader
Lifespanlifespan_secs(N), lifespan_millis(N)InfiniteWriter ≥ Reader
LatencyBudgetlatency_budget_millis(N), latency_budget_secs(N)ZeroHint (no check)
TimeBasedFiltertime_based_filter_millis(N), time_based_filter_secs(N)Zero (disabled)N/A (reader-only)
TransportPrioritytransport_priority(N), transport_priority_high(), transport_priority_low()0 (normal)Hint (no check)

Ownership

PolicyValuesDefaultCompatibility
Ownershipownership_shared(), ownership_exclusive()SharedExact match
OwnershipStrengthownership_strength(N), ownership_strength_high(), ownership_strength_low()0N/A (writer-only)

Partition

PolicyValuesDefaultCompatibility
Partitionpartition_single(name), partition(Partition)Default (empty)Intersection

Lifecycle

PolicyValuesDefaultCompatibility
Livelinessliveliness_automatic(), liveliness_manual_by_participant(), liveliness_manual_by_topic()AutomaticWriter ≥ 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

WriterReaderMatch
reliable()reliable()Yes
reliable()best_effort()Yes
best_effort()best_effort()Yes
best_effort()reliable()No

Durability

WriterReaderMatch
persistent()AnyYes
transient_local()transient_local()/volatile()Yes
transient_local()persistent()No
volatile()volatile()Yes
volatile()transient_local()/persistent()No

Liveliness

WriterReaderMatch
manual_by_topicAnyYes
manual_by_participantmanual_by_participant/automaticYes
manual_by_participantmanual_by_topicNo
automaticautomaticYes
automaticmanual_*No

Ownership

WriterReaderMatch
sharedsharedYes
exclusiveexclusiveYes
sharedexclusiveNo
exclusivesharedNo

Lifespan

WriterReaderMatch
10s5sYes
5s5sYes
5s10sNo
InfiniteAnyYes
FiniteInfiniteNo

Partition

WriterReaderMatch
["A"]["A"]Yes
["A"]["B"]No
["A","B"]["B"]Yes
[] (default)[] (default)Yes
["A"][] (default)No

Fluent Builder API

Available Methods

MethodDescription
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

See Also