Expand description
Client-side offset persistence for LANCE consumers
Provides traits and implementations for storing consumer offsets locally, enabling stateless broker architecture per the Client-Managed Offset Strategy.
§Design Philosophy
LANCE treats the broker as a stateless data pipe. Offset tracking is the client’s responsibility, enabling:
- Exactly-once semantics (store offset with business data atomically)
- Stateless horizontal scaling
- Reduced broker metadata overhead
§Example
ⓘ
use lnc_client::offset::{OffsetStore, LockFileOffsetStore};
use std::path::Path;
let store = LockFileOffsetStore::open(
Path::new("/var/lib/lance/offsets"),
"my-consumer",
)?;
// Load stored offset for a topic
let offset = store.load(topic_id, consumer_id).unwrap_or(0);
// After processing, save the new offset
store.save(topic_id, consumer_id, new_offset)?;Structs§
- Collecting
Commit Hook - A hook that collects commit events for testing
- Commit
Info - Information about a committed offset
- Hooked
Offset Store - Offset store wrapper that invokes post-commit hooks
- Lock
File Offset Store - File-based offset store with lock file protection
- Logging
Commit Hook - A simple logging hook for debugging
- Memory
Offset Store - In-memory offset store for testing and ephemeral consumers
Traits§
- Offset
Store - Trait for client-side offset persistence
- Post
Commit Hook - Trait for post-commit hooks