MCPcopy Create free account
hub / github.com/cowprotocol/services / append

Function append

crates/database/src/events.rs:73–90  ·  view source on GitHub ↗
(
    ex: &mut PgTransaction<'_>,
    events: &[(EventIndex, Event)],
)

Source from the content-addressed store, hash-verified

71
72#[instrument(skip_all)]
73pub async fn append(
74 ex: &mut PgTransaction<'_>,
75 events: &[(EventIndex, Event)],
76) -> Result<(), sqlx::Error> {
77 // TODO: there might be a more efficient way to do this like execute_many or
78 // COPY but my tests show that even if we sleep during the transaction it
79 // does not block other connections from using the database, so it's not
80 // high priority.
81 for (index, event) in events {
82 match event {
83 Event::Trade(event) => insert_trade(ex, index, event).await?,
84 Event::Invalidation(event) => insert_invalidation(ex, index, event).await?,
85 Event::Settlement(event) => insert_settlement(ex, index, event).await?,
86 Event::PreSignature(event) => insert_presignature(ex, index, event).await?,
87 };
88 }
89 Ok(())
90}
91
92#[instrument(skip_all)]
93async fn insert_invalidation(

Callers 12

pre_signature_eventFunction · 0.70
postgres_solvable_ordersFunction · 0.70
postgres_orders_in_txFunction · 0.70
postgres_gets_eventFunction · 0.70
add_tradeFunction · 0.70
add_settlementFunction · 0.70
append_eventsFunction · 0.50
replace_eventsFunction · 0.50
insert_eventsMethod · 0.50

Calls 4

insert_tradeFunction · 0.85
insert_invalidationFunction · 0.85
insert_settlementFunction · 0.85
insert_presignatureFunction · 0.85

Tested by

no test coverage detected