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

Method append

libatomic/src/daemon/journal_sink.rs:164–199  ·  view source on GitHub ↗
(
        &self,
        reservation: JournalTurnReservation,
        envelopes: Vec<ProvenanceJournalEnvelope>,
        now: i64,
    )

Source from the content-addressed store, hash-verified

162 }
163
164 fn append(
165 &self,
166 reservation: JournalTurnReservation,
167 envelopes: Vec<ProvenanceJournalEnvelope>,
168 now: i64,
169 ) -> Result<Vec<JournalAppendAck>, String> {
170 let batch: Vec<(String, Vec<u8>)> = envelopes
171 .iter()
172 .map(|envelope| {
173 Ok((
174 envelope.event_id.clone(),
175 envelope.to_json_bytes().map_err(|e| e.to_string())?,
176 ))
177 })
178 .collect::<Result<_, String>>()?;
179 let refs: Vec<(&str, &[u8])> = batch
180 .iter()
181 .map(|(id, bytes)| (id.as_str(), bytes.as_slice()))
182 .collect();
183 let stored = self
184 .store()?
185 .append_provenance_envelopes(
186 ProvenanceId::new(reservation.provenance_id),
187 reservation.generation,
188 &refs,
189 now,
190 )
191 .map_err(|error| error.to_string())?;
192 Ok(stored
193 .into_iter()
194 .map(|event| JournalAppendAck {
195 event_id: event.event_id,
196 sequence: event.seq,
197 })
198 .collect())
199 }
200
201 fn prepare_checkpoint(
202 &self,

Callers 15

measure_turnFunction · 0.45
measure_caseFunction · 0.45
summarizeFunction · 0.45
mainFunction · 0.45
workerFunction · 0.45
verifyFunction · 0.45
measureFunction · 0.45
summarizeFunction · 0.45
executeFunction · 0.45
source_fingerprintFunction · 0.45
summarizeFunction · 0.45
mainFunction · 0.45

Calls 9

to_json_bytesMethod · 0.80
iterMethod · 0.45
cloneMethod · 0.45
collectMethod · 0.45
as_strMethod · 0.45
as_sliceMethod · 0.45
storeMethod · 0.45
into_iterMethod · 0.45