pub struct Watermark {
pub last_rowid: i64,
}Expand description
Persisted high-water ROWID for the inbound reader.
Serialized as {"last_rowid": <i64>} JSON, written atomically (temp +
rename) under an INJECTABLE base dir so tests never touch the real
~/.car/.
Fields§
§last_rowid: i64Implementations§
Source§impl Watermark
impl Watermark
pub fn new(last_rowid: i64) -> Self
Sourcepub fn path_in(base_dir: &Path) -> PathBuf
pub fn path_in(base_dir: &Path) -> PathBuf
Resolve the watermark JSON file inside base_dir (the ~/.car/
equivalent). The file lives at <base_dir>/messages-inbound-watermark.json.
Sourcepub fn load(base_dir: &Path) -> Result<Option<Self>, IntegrationError>
pub fn load(base_dir: &Path) -> Result<Option<Self>, IntegrationError>
Load the watermark from disk. Returns Ok(None) when no file exists
(fresh boot — caller seeds to MAX(ROWID)).
Sourcepub fn persist(&self, base_dir: &Path) -> Result<(), IntegrationError>
pub fn persist(&self, base_dir: &Path) -> Result<(), IntegrationError>
Persist the watermark atomically under base_dir.
Mirrors the car-server-core atomic_write_sync / supervisor.rs
write_json_atomic shape — create_dir_all + write a unique temp file
in the same dir + rename(2) (atomic on the same filesystem). NOT a
plain non-atomic fs::write; NOT Swift UserDefaults. car-server-core’s
atomic_write_sync is private to that crate and not reachable from
car-integrations, so the shape is mirrored locally per the plan.