Skip to main content

Feature Flags

Cargo feature flags for optional HDDS functionality.

Overview​

HDDS uses Cargo features to enable optional functionality. This reduces binary size and compile time for applications that don't need all features.

Default Features​

[dependencies]
# Clone: git clone https://git.hdds.io/hdds/hdds.git
hdds = { path = "../hdds/crates/hdds" } # Includes: xtypes, qos-loaders
FeatureDescription
xtypesXTypes type system (TypeIdentifier, TypeObject)
qos-loadersXML/YAML QoS profile loading

All Features​

caution

There is no "all" meta-feature. Enable individual features as needed (see below).

Feature Reference​

Core Features​

FeatureDependenciesDescription
xtypesmd-5XTypes type system with MD5 type hashing
type-lookupxtypesTypeLookup service (HDDS-to-HDDS only)
dynamic-types-Runtime type construction (DynamicData)
qos-loadersroxmltree, serde, serde_yamlLoad QoS profiles from XML/YAML

Transport Features​

FeatureDependenciesDescription
quicquinn, rustls, rustls-pemfile, rcgen, tokioQUIC transport with 0-RTT, NAT traversal, connection migration
tcp-tlsrustls, webpki-roots, rustls-pemfileTLS encryption for TCP transport
lowbw-lz4lz4_flexLZ4 compression for low-bandwidth links

Security Feature​

FeatureDependenciesDescription
securityring, x509-parser, pem, webpki, base64, zeroizeDDS Security (authentication, encryption, access control)

Discovery Features​

FeatureDependenciesDescription
cloud-discoveryreqwest, serde, serde_json, tokioAWS/Azure/Consul discovery backends
k8s-Kubernetes Headless Service discovery

Communication Features​

FeatureDependenciesDescription
rpctokioDDS-RPC Request/Reply pattern

Observability Features​

FeatureDependenciesDescription
telemetry-Metrics collection and streaming
logging-Compile-time configurable logging
traceloggingFunction entry tracing (requires logging)

OpenTelemetry (Separate Crate)​

The hdds-telemetry-otlp crate provides OTLP export for traces and metrics:

[dependencies]
hdds-telemetry-otlp = { path = "../hdds/crates/hdds-telemetry-otlp" }
FeatureDependenciesDescription
(default)opentelemetry 0.31, tracing-opentelemetry 0.32, tonicOTLP gRPC export for traces and metrics

Compatible with Jaeger, Grafana Tempo, Datadog, and any OpenTelemetry Collector.

Debugging Features​

FeatureDependenciesDescription
rti-hexdump-Verbose RTI packet hex dumps
bench-stress-Stress test benchmarks

Vendor Dialect Features​

FeatureDescription
dialect-coredxCoreDX DDS compatibility
dialect-dustDust DDS compatibility
dialect-gurumGurum DDS compatibility
dialect-intercomInterCOM DDS compatibility
dialect-openspliceOpenSplice DDS compatibility

Usage Examples​

Minimal (no optional features)​

[dependencies]
hdds = { path = "../hdds/crates/hdds", default-features = false }

Security + Cloud Discovery​

[dependencies]
hdds = { path = "../hdds/crates/hdds", features = ["security", "cloud-discovery"] }

Embedded/Constrained (no XML, no security)​

[dependencies]
hdds = { path = "../hdds/crates/hdds", default-features = false, features = ["lowbw-lz4"] }
[dependencies]
hdds = { path = "../hdds/crates/hdds", features = [
"security",
"cloud-discovery",
"tcp-tls",
"rpc",
"telemetry",
"logging",
"dynamic-types",
]}

Kubernetes Deployment​

[dependencies]
hdds = { path = "../hdds/crates/hdds", features = ["k8s", "telemetry"] }

Feature Details​

xtypes​

Enables XTypes type system:

  • TypeIdentifier and TypeObject
  • Type equivalence checking
  • MD5-based type hashing
use hdds::xtypes::{TypeIdentifier, TypeObject};

let type_id = TypeIdentifier::from_type::<SensorData>();

type-lookup​

Enables TypeLookup service for runtime type discovery:

// Request type information from remote participant
let type_obj = participant.lookup_type(&type_id)?;
warning

TypeLookup is HDDS-to-HDDS only. Other vendors use incompatible implementations.

dynamic-types​

Enables runtime type construction:

use hdds::dynamic::{TypeDescriptorBuilder, DynamicData, PrimitiveKind};

let desc = TypeDescriptorBuilder::new("SensorReading")
.field("sensor_id", PrimitiveKind::U32)
.field("temperature", PrimitiveKind::F64)
.build();

let mut data = DynamicData::new(&Arc::new(desc));
data.set("sensor_id", 42u32)?;

security​

Enables DDS Security plugins:

  • Authentication (X.509 PKI)
  • Encryption (AES-256-GCM)
  • Access control (Permissions documents)
use hdds::security::{SecurityConfig, AuthenticationPlugin};

let config = SecurityConfig::builder()
.identity_ca("/path/to/ca.pem")
.identity_cert("/path/to/cert.pem")
.identity_key("/path/to/key.pem")
.build()?;

tcp-tls​

Enables TLS encryption for TCP transport:

use hdds::transport::tcp::{TlsConfig, TlsVersion};

let tls = TlsConfig::builder()
.cert_file("/path/to/cert.pem")
.key_file("/path/to/key.pem")
.ca_file("/path/to/ca.pem")
.min_version(TlsVersion::Tls12)
.build()?;

lowbw-lz4​

Enables LZ4 compression for low-bandwidth transport:

use hdds::transport::lowbw::LowBwConfig;

let config = LowBwConfig {
compression: true, // Enable LZ4
..Default::default()
};

cloud-discovery​

Enables cloud service discovery backends:

use hdds::discovery::cloud::{AwsCloudMapConfig, ConsulConfig};

// AWS Cloud Map
let aws = AwsCloudMapConfig::new("my-namespace", "my-service");

// Consul
let consul = ConsulConfig::new("http://consul:8500", "hdds-service");

k8s​

Enables Kubernetes DNS-based discovery (zero dependencies):

use hdds::discovery::k8s::K8sConfig;

let config = K8sConfig::new("hdds-headless.default.svc.cluster.local");

rpc​

Enables DDS-RPC Request/Reply pattern:

use hdds::rpc::{ServiceClient, ServiceServer};

// Client
let client = ServiceClient::new(participant, "Calculator")?;
let result: i32 = client.call("add", (1, 2)).await?;

// Server
let server = ServiceServer::new(participant, "Calculator")?;
server.register("add", |a: i32, b: i32| a + b);
server.run().await?;

telemetry​

Enables metrics collection and streaming:

use hdds::telemetry::{init_metrics, init_exporter};

let metrics = init_metrics();
let exporter = init_exporter("0.0.0.0:4242")?;

logging​

Enables compile-time configurable logging:

use hdds::logging::{init_logger, ConsoleOutput, LogLevel};

init_logger(Arc::new(ConsoleOutput::new(LogLevel::Debug)), LogLevel::Debug);
info!("Application started");

Vendor Dialects​

Enable compatibility with specific DDS vendors:

# For CoreDX interop
hdds = { path = "../hdds/crates/hdds", features = ["dialect-coredx"] }

Dialect features adjust:

  • Participant announcement format
  • QoS encoding quirks
  • Discovery timing parameters

Binary Size Impact​

Approximate binary size impact per feature (release build, LTO):

FeatureSize Impact
Base (no features)~800 KB
xtypes+50 KB
security+200 KB
tcp-tls+150 KB
cloud-discovery+300 KB
qos-loaders+100 KB
telemetry+30 KB
logging+10 KB