(&self, table_id: TableId, buffer: &mut [u8])
| 356 | } |
| 357 | |
| 358 | pub fn insert(&self, table_id: TableId, buffer: &mut [u8]) -> Result<usize, NodesError> { |
| 359 | let stdb = self.relational_db(); |
| 360 | let tx = &mut *self.get_tx()?; |
| 361 | |
| 362 | let (row_len, row_ptr, insert_flags) = stdb |
| 363 | .insert(tx, table_id, buffer) |
| 364 | .map(|(gen_cols, row_ref, insert_flags)| { |
| 365 | let row_len = Self::project_cols_bsatn(buffer, gen_cols, row_ref); |
| 366 | (row_len, row_ref.pointer(), insert_flags) |
| 367 | }) |
| 368 | .inspect_err( |
| 369 | #[cold] |
| 370 | #[inline(never)] |
| 371 | |e| match e { |
| 372 | DBError::Datastore(DatastoreError::Index(IndexError::UniqueConstraintViolation(_))) => {} |
| 373 | _ => { |
| 374 | let res = stdb.table_name_from_id_mut(tx, table_id); |
| 375 | if let Ok(Some(table_name)) = res { |
| 376 | log::debug!("insert(table: {table_name}, table_id: {table_id}): {e}") |
| 377 | } else { |
| 378 | log::debug!("insert(table_id: {table_id}): {e}") |
| 379 | } |
| 380 | } |
| 381 | }, |
| 382 | )?; |
| 383 | |
| 384 | if insert_flags.is_scheduler_table { |
| 385 | self.schedule_row(stdb, tx, table_id, row_ptr)?; |
| 386 | } |
| 387 | |
| 388 | // Note, we update the metric for bytes written after the insert. |
| 389 | // This is to capture auto-inc columns. |
| 390 | tx.metrics.bytes_written += buffer.len(); |
| 391 | |
| 392 | Ok(row_len) |
| 393 | } |
| 394 | |
| 395 | #[cold] |
| 396 | #[inline(never)] |
nothing calls this directly
no test coverage detected