Skip to content

Commit 1645118

Browse files
committed
store: Pass only references into WritableStore.transact_block_operations
1 parent 8543114 commit 1645118

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

store/postgres/src/writable.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -218,26 +218,26 @@ impl WritableStore {
218218

219219
fn transact_block_operations(
220220
&self,
221-
block_ptr_to: BlockPtr,
222-
firehose_cursor: Option<String>,
223-
mods: Vec<EntityModification>,
221+
block_ptr_to: &BlockPtr,
222+
firehose_cursor: Option<&str>,
223+
mods: &[EntityModification],
224224
stopwatch: StopwatchMetrics,
225-
data_sources: Vec<StoredDynamicDataSource>,
226-
deterministic_errors: Vec<SubgraphError>,
225+
data_sources: &[StoredDynamicDataSource],
226+
deterministic_errors: &[SubgraphError],
227227
) -> Result<(), StoreError> {
228228
assert!(
229-
same_subgraph(&mods, &self.site.deployment),
229+
same_subgraph(mods, &self.site.deployment),
230230
"can only transact operations within one shard"
231231
);
232232
self.retry("transact_block_operations", move || {
233233
let event = self.writable.transact_block_operations(
234234
self.site.clone(),
235-
&block_ptr_to,
236-
firehose_cursor.as_deref(),
237-
&mods,
235+
block_ptr_to,
236+
firehose_cursor,
237+
mods,
238238
stopwatch.cheap_clone(),
239-
&data_sources,
240-
&deterministic_errors,
239+
data_sources,
240+
deterministic_errors,
241241
)?;
242242

243243
let _section = stopwatch.start_section("send_store_event");
@@ -319,7 +319,7 @@ impl WritableStore {
319319
}
320320
}
321321

322-
fn same_subgraph(mods: &Vec<EntityModification>, id: &DeploymentHash) -> bool {
322+
fn same_subgraph(mods: &[EntityModification], id: &DeploymentHash) -> bool {
323323
mods.iter().all(|md| &md.entity_key().subgraph_id == id)
324324
}
325325

@@ -407,12 +407,12 @@ impl WritableStoreTrait for WritableAgent {
407407
deterministic_errors: Vec<SubgraphError>,
408408
) -> Result<(), StoreError> {
409409
self.store.transact_block_operations(
410-
block_ptr_to.clone(),
411-
firehose_cursor.clone(),
412-
mods,
410+
&block_ptr_to,
411+
firehose_cursor.as_deref(),
412+
&mods,
413413
stopwatch,
414-
data_sources,
415-
deterministic_errors,
414+
&data_sources,
415+
&deterministic_errors,
416416
)?;
417417

418418
*self.block_ptr.lock().unwrap() = Some(block_ptr_to);

0 commit comments

Comments
 (0)