MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / append_batch

Method append_batch

src/storage/src/source/reclock.rs:178–193  ·  view source on GitHub ↗

Appends the provided updates to the remap collection at the next available minting IntoTime and updates this operator's in-memory state accordingly. If an attempt to mint bindings fails due to another process having raced and appended bindings concurrently then the current global upper will be returned as an error. This is the frontier that this operator must be synced to for a future append atte

(
        &mut self,
        updates: Vec<(FromTime, IntoTime, Diff)>,
        new_upper: &Antichain<IntoTime>,
    )

Source from the content-addressed store, hash-verified

176 /// the frontier that this operator must be synced to for a future append attempt to have any
177 /// chance of success.
178 async fn append_batch(
179 &mut self,
180 updates: Vec<(FromTime, IntoTime, Diff)>,
181 new_upper: &Antichain<IntoTime>,
182 ) -> Result<ReclockBatch<FromTime, IntoTime>, UpperMismatch<IntoTime>> {
183 match self
184 .remap_handle
185 .compare_and_append(updates, self.upper.clone(), new_upper.clone())
186 .await
187 {
188 // We have successfully produced data in the remap collection so let's read back what
189 // we wrote to update our local state
190 Ok(()) => Ok(self.sync(new_upper.borrow()).await),
191 Err(mismatch) => Err(mismatch),
192 }
193 }
194}
195
196#[cfg(test)]

Callers 1

mintMethod · 0.45

Calls 4

compare_and_appendMethod · 0.45
cloneMethod · 0.45
syncMethod · 0.45
borrowMethod · 0.45

Tested by

no test coverage detected