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

Function get_changes_asc

src/sql-server-util/src/inspect.rs:235–254  ·  view source on GitHub ↗

Queries the specified capture instance and returns all changes from `[start_lsn, end_lsn)`, ordered by `start_lsn` in an ascending fashion.

(
    client: &mut Client,
    capture_instance: &str,
    start_lsn: Lsn,
    end_lsn: Lsn,
    filter: RowFilterOption,
)

Source from the content-addressed store, hash-verified

233/// Queries the specified capture instance and returns all changes from
234/// `[start_lsn, end_lsn)`, ordered by `start_lsn` in an ascending fashion.
235pub fn get_changes_asc(
236 client: &mut Client,
237 capture_instance: &str,
238 start_lsn: Lsn,
239 end_lsn: Lsn,
240 filter: RowFilterOption,
241) -> impl Stream<Item = Result<tiberius::Row, SqlServerError>> + Send {
242 const START_LSN_COLUMN: &str = "__$start_lsn";
243 let query = format!(
244 "SELECT * FROM cdc.{function}(@P1, @P2, N'{filter}') ORDER BY {START_LSN_COLUMN} ASC;",
245 function = quote_identifier(&format!("fn_cdc_get_all_changes_{capture_instance}"))
246 );
247 client.query_streaming(
248 query,
249 &[
250 &start_lsn.as_bytes().as_slice(),
251 &end_lsn.as_bytes().as_slice(),
252 ],
253 )
254}
255
256/// Cleans up the change table associated with the specified `capture_instance` by
257/// deleting `max_deletes` entries with a `start_lsn` less than `low_water_mark`.

Callers

nothing calls this directly

Calls 3

query_streamingMethod · 0.80
as_sliceMethod · 0.80
as_bytesMethod · 0.45

Tested by

no test coverage detected