1.3 KiB
1.3 KiB
SQ-001: Domain Types
Status: [x] DONE
Blocked by: SQ-000
Priority: High
Description
Define the core domain types in sq-models: Message, Header, TopicName, Offset, and configuration types. These are the foundational types used throughout the entire system.
Files to Create/Modify
crates/sq-models/src/lib.rs- re-exportscrates/sq-models/src/message.rs- Message, Header, TopicName, Offset typescrates/sq-models/src/config.rs- TopicConfig, WalConfig
Key Types
pub struct Message {
pub offset: u64,
pub topic: TopicName,
pub key: Option<Vec<u8>>,
pub value: Vec<u8>,
pub headers: Vec<Header>,
pub timestamp_ms: u64,
}
pub struct Header {
pub key: String,
pub value: Vec<u8>,
}
pub struct TopicName(pub String);
pub struct WalConfig {
pub max_segment_bytes: u64, // default 64MB
pub max_segment_age_secs: u64, // default 60s
pub data_dir: PathBuf,
}
pub struct TopicConfig {
pub name: TopicName,
pub partitions: u32, // default 1
pub replication_factor: u32, // default 3
}
Acceptance Criteria
- All types compile and are public
MessageimplementsClone,Debug,PartialEq- Unit test: construct a Message, verify all fields
- Property test (optional): arbitrary Message roundtrip through Debug/PartialEq