Skip to content

Commit b7b3142

Browse files
committed
Remove unnecessary transactiontraits
Signed-off-by: mrrajan <86094767+mrrajan@users.noreply.github.com.>
1 parent 0fb3db1 commit b7b3142

3 files changed

Lines changed: 11 additions & 26 deletions

File tree

modules/ingestor/src/graph/sbom/common/expanded_license.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ use uuid::Uuid;
2828
///
2929
/// Both use the same core logic (expand_license_expression_with_mappings + md5 hash
3030
/// matching) but optimize for their different use cases.
31-
pub async fn populate_expanded_license<C>(sbom_id: Uuid, db: &C) -> Result<(), DbErr>
32-
where
33-
C: ConnectionTrait,
34-
{
31+
pub async fn populate_expanded_license(sbom_id: Uuid, db: &impl ConnectionTrait) -> Result<(), DbErr> {
3532
// Step 1: Insert into expanded_license dictionary
3633
db.execute(Statement::from_sql_and_values(
3734
db.get_database_backend(),

modules/ingestor/src/graph/sbom/cyclonedx.rs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use sbom_walker::{
2121
model::sbom::serde_cyclonedx::Sbom,
2222
report::{ReportSink, check},
2323
};
24-
use sea_orm::{ConnectionTrait, TransactionTrait};
24+
use sea_orm::ConnectionTrait;
2525
use serde_cyclonedx::cyclonedx::v_1_6::{
2626
Component, ComponentEvidenceIdentity, CycloneDx, LicenseChoiceUrl, OrganizationalContact,
2727
};
@@ -138,15 +138,12 @@ impl<'a> From<Information<'a>> for SbomInformation {
138138

139139
impl SbomContext {
140140
#[instrument(skip(connection, sbom, warnings), err(level=tracing::Level::INFO))]
141-
pub async fn ingest_cyclonedx<C>(
141+
pub async fn ingest_cyclonedx(
142142
&self,
143143
mut sbom: Box<CycloneDx>,
144144
warnings: &dyn ReportSink,
145-
connection: &C,
146-
) -> Result<(), Error>
147-
where
148-
C: ConnectionTrait + TransactionTrait,
149-
{
145+
connection: &impl ConnectionTrait,
146+
) -> Result<(), Error> {
150147
// pre-flight checks
151148

152149
check::serde_cyclonedx::all(warnings, &Sbom::V1_6(Cow::Borrowed(&sbom)));
@@ -288,10 +285,7 @@ impl<'a> Creator<'a> {
288285
}
289286

290287
#[instrument(skip(self, db, processors), err(level=tracing::Level::INFO))]
291-
pub async fn create<C>(self, db: &C, processors: &mut [Box<dyn Processor>]) -> Result<(), Error>
292-
where
293-
C: ConnectionTrait + TransactionTrait,
294-
{
288+
pub async fn create(self, db: &impl ConnectionTrait, processors: &mut [Box<dyn Processor>]) -> Result<(), Error> {
295289
let mut creator = ComponentCreator::new(self.sbom_id, self.components.len());
296290

297291
for comp in self.components {
@@ -578,10 +572,7 @@ impl ComponentCreator {
578572
// order matters to prevent cross-table deadlocks when running
579573
// concurrent SBOM ingestions. All SBOM loaders must use the same
580574
// table insertion order.
581-
async fn create<C>(self, db: &C) -> Result<(), Error>
582-
where
583-
C: ConnectionTrait + TransactionTrait,
584-
{
575+
async fn create(self, db: &impl ConnectionTrait) -> Result<(), Error> {
585576
self.licenses.create(db).await?;
586577
self.purls.create(db).await?;
587578
self.cpes.create(db).await?;

modules/ingestor/src/graph/sbom/spdx.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::{
1616
service::Error,
1717
};
1818
use sbom_walker::report::{ReportSink, check};
19-
use sea_orm::{ConnectionTrait, TransactionTrait};
19+
use sea_orm::ConnectionTrait;
2020
use spdx_rs::models::{RelationshipType, SPDX};
2121
use std::collections::HashSet;
2222
use std::str::FromStr;
@@ -103,15 +103,12 @@ impl<'a> From<Information<'a>> for SbomInformation {
103103

104104
impl SbomContext {
105105
#[instrument(skip(db, sbom_data, warnings), ret(level=tracing::Level::DEBUG))]
106-
pub async fn ingest_spdx<C>(
106+
pub async fn ingest_spdx(
107107
&self,
108108
sbom_data: SPDX,
109109
warnings: &dyn ReportSink,
110-
db: &C,
111-
) -> Result<(), Error>
112-
where
113-
C: ConnectionTrait + TransactionTrait,
114-
{
110+
db: &impl ConnectionTrait,
111+
) -> Result<(), Error> {
115112
// pre-flight checks
116113

117114
check::spdx::all(warnings, &sbom_data);

0 commit comments

Comments
 (0)