MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / load_frozen_page

Function load_frozen_page

libatomic/src/daemon/provenance_core.rs:195–229  ·  view source on GitHub ↗

Read one bounded part of the frozen journal. Continuation requests (cursor past the first page) trip the before-frozen-page-continuation seam; a successful read under the injected frozen-page-unavailable failpoint surfaces the legacy injected error text instead.

(
    store: &RedbChangeStore,
    id: ProvenanceId,
    attempt_generation: u64,
    frozen_event_count: u64,
    cursor: FrozenProvenanceCursor,
    requested_budget: Option<usize>,
)

Source from the content-addressed store, hash-verified

193/// seam; a successful read under the injected frozen-page-unavailable
194/// failpoint surfaces the legacy injected error text instead.
195pub fn load_frozen_page(
196 store: &RedbChangeStore,
197 id: ProvenanceId,
198 attempt_generation: u64,
199 frozen_event_count: u64,
200 cursor: FrozenProvenanceCursor,
201 requested_budget: Option<usize>,
202) -> Result<FrozenProvenancePage, JournalError> {
203 if cursor != FrozenProvenanceCursor::default() {
204 owner_failpoint("before-frozen-page-continuation");
205 }
206 let budget = requested_budget
207 .map(|requested| requested.min(frozen_page_budget()))
208 .unwrap_or_else(frozen_page_budget);
209 match store.load_frozen_provenance_page(
210 id,
211 attempt_generation,
212 frozen_event_count,
213 cursor,
214 budget,
215 ) {
216 Ok(page) => {
217 if std::env::var("ATOMIC_OWNER_FAILPOINT").ok().as_deref()
218 == Some("frozen-page-unavailable")
219 {
220 return Err(JournalError {
221 code: ErrorCode::ProvenanceCheckpoint,
222 message: "injected frozen page read failure".to_string(),
223 });
224 }
225 Ok(page)
226 }
227 Err(error) => Err(JournalError::store(ErrorCode::ProvenanceCheckpoint, error)),
228 }
229}
230
231/// Reassemble only complete envelopes, advancing the cursor after a
232/// successful page. Retrying an RPC cannot append its bytes twice.

Callers 2

load_frozen_envelopesFunction · 0.85

Calls 5

owner_failpointFunction · 0.85
frozen_page_budgetFunction · 0.85
storeFunction · 0.85
okMethod · 0.45

Tested by

no test coverage detected