@@ -21,7 +21,7 @@ use sbom_walker::{
2121 model:: sbom:: serde_cyclonedx:: Sbom ,
2222 report:: { ReportSink , check} ,
2323} ;
24- use sea_orm:: ConnectionTrait ;
24+ use sea_orm:: { ConnectionTrait , TransactionTrait } ;
2525use serde_cyclonedx:: cyclonedx:: v_1_6:: {
2626 Component , ComponentEvidenceIdentity , CycloneDx , LicenseChoiceUrl , OrganizationalContact ,
2727} ;
@@ -138,12 +138,15 @@ impl<'a> From<Information<'a>> for SbomInformation {
138138
139139impl SbomContext {
140140 #[ instrument( skip( connection, sbom, warnings) , err( level=tracing:: Level :: INFO ) ) ]
141- pub async fn ingest_cyclonedx < C : ConnectionTrait > (
141+ pub async fn ingest_cyclonedx < C > (
142142 & self ,
143143 mut sbom : Box < CycloneDx > ,
144144 warnings : & dyn ReportSink ,
145145 connection : & C ,
146- ) -> Result < ( ) , Error > {
146+ ) -> Result < ( ) , Error >
147+ where
148+ C : ConnectionTrait + TransactionTrait ,
149+ {
147150 // pre-flight checks
148151
149152 check:: serde_cyclonedx:: all ( warnings, & Sbom :: V1_6 ( Cow :: Borrowed ( & sbom) ) ) ;
@@ -285,11 +288,10 @@ impl<'a> Creator<'a> {
285288 }
286289
287290 #[ instrument( skip( self , db, processors) , err( level=tracing:: Level :: INFO ) ) ]
288- pub async fn create (
289- self ,
290- db : & impl ConnectionTrait ,
291- processors : & mut [ Box < dyn Processor > ] ,
292- ) -> Result < ( ) , Error > {
291+ pub async fn create < C > ( self , db : & C , processors : & mut [ Box < dyn Processor > ] ) -> Result < ( ) , Error >
292+ where
293+ C : ConnectionTrait + TransactionTrait ,
294+ {
293295 let mut creator = ComponentCreator :: new ( self . sbom_id , self . components . len ( ) ) ;
294296
295297 for comp in self . components {
@@ -576,7 +578,10 @@ impl ComponentCreator {
576578 // order matters to prevent cross-table deadlocks when running
577579 // concurrent SBOM ingestions. All SBOM loaders must use the same
578580 // table insertion order.
579- async fn create ( self , db : & impl ConnectionTrait ) -> Result < ( ) , Error > {
581+ async fn create < C > ( self , db : & C ) -> Result < ( ) , Error >
582+ where
583+ C : ConnectionTrait + TransactionTrait ,
584+ {
580585 self . licenses . create ( db) . await ?;
581586 self . purls . create ( db) . await ?;
582587 self . cpes . create ( db) . await ?;
0 commit comments