diff options
| author | 2025-02-10 11:38:52 +0000 | |
|---|---|---|
| committer | 2025-02-10 11:44:34 +0000 | |
| commit | c00dcd6f7904e396ffe1132ffba166d6aa345c85 (patch) | |
| tree | f2f9ceeebb5de38a8278b1e568cbd01cbdda5d7b | |
| parent | ad5ae5bcee55a59fad5ef3e7d29d26b9edbf1267 (diff) | |
Add a footer to the Debug store
Update the debug store to include a footer (;;) to allow accurate identification of truncated store instances, and bump up its encoding version
Bug: 394834329
Test: atest libdebugstore_tests
Flag: EXEMPT bug fix
Change-Id: Ia32b8920d4af9cd3b8698532fbf1c53cbf16ac65
| -rw-r--r-- | libs/debugstore/rust/src/core.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libs/debugstore/rust/src/core.rs b/libs/debugstore/rust/src/core.rs index a8acdedc55..16147dd092 100644 --- a/libs/debugstore/rust/src/core.rs +++ b/libs/debugstore/rust/src/core.rs @@ -48,7 +48,7 @@ impl DebugStore { /// /// This constant is used as a part of the debug store's data format, /// allowing for version tracking and compatibility checks. - const ENCODE_VERSION: u32 = 2; + const ENCODE_VERSION: u32 = 3; /// Creates a new instance of `DebugStore` with specified event limit and maximum delay. fn new() -> Self { @@ -123,9 +123,11 @@ impl DebugStore { impl fmt::Display for DebugStore { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + // Write the debug store header information let uptime_now = uptimeMillis(); write!(f, "{},{},{}::", Self::ENCODE_VERSION, self.event_store.len(), uptime_now)?; + // Join events with a separator write!( f, "{}", @@ -136,7 +138,10 @@ impl fmt::Display for DebugStore { acc.push_str(&event.to_string()); acc }) - ) + )?; + + // Write the debug store footer + write!(f, ";;") } } |