Expand description
Strongly-typed identifiers with SipHash integration
This module provides type-safe wrappers around numeric IDs that are derived from string names via SipHash. This provides both efficiency (4-byte IDs on wire) and type safety (can’t mix up different ID types).
§Examples
use synapse_primitives::id::{InterfaceId, MethodId, ServiceId, HeaderKeyId};
// Create IDs from names
let interface_id = InterfaceId::from_name("mensa.user.v2.UserInterface");
let method_id = MethodId::from_name("GetUser");
let service_id = ServiceId::from_name("user-service");
let header_id = HeaderKeyId::from_name("trace_id");
// Use in protobuf or network protocols
let wire_format: u32 = interface_id.into();
let restored = InterfaceId::from_raw(wire_format);
assert_eq!(interface_id, restored);Modules§
- well_
known - Common header key IDs for standard headers
Structs§
- Header
KeyId - Header key identifier - represents a header name in RPC messages
- Instance
Id - Instance identifier - represents a specific running instance of a service
- Interface
Id - Interface identifier - represents a protobuf-defined RPC interface
- Method
Id - Method identifier - represents a method within an RPC interface
- Metric
Id - Metric identifier - represents a metric name for monitoring
- Service
Id - Service identifier - represents a logical service unit