Skip to content

Commit 9315fdd

Browse files
committed
format
1 parent 2b7f874 commit 9315fdd

2 files changed

Lines changed: 39 additions & 9 deletions

File tree

indexer/src/cli.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,12 @@ fn run_index(args: IndexArgs) -> Result<()> {
116116
let options = upload::UploadOptions {
117117
incremental_symbols: !args.full_symbol_upload,
118118
};
119-
upload::upload_index_with_options(url, args.upload_api_key.as_deref(), &artifacts, &options)?;
119+
upload::upload_index_with_options(
120+
url,
121+
args.upload_api_key.as_deref(),
122+
&artifacts,
123+
&options,
124+
)?;
120125
}
121126

122127
info!(repo = repository, output = ?output_dir, files = artifacts.file_pointer_count(), "indexing complete");

indexer/src/upload.rs

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,13 @@ pub fn upload_index_with_options(
9595

9696
// 5. Upload manifest shards per section
9797
info!("uploading manifest shards");
98-
upload_manifest_shards(&client, &endpoints, api_key, artifacts, needed_hashes.as_ref())?;
98+
upload_manifest_shards(
99+
&client,
100+
&endpoints,
101+
api_key,
102+
artifacts,
103+
needed_hashes.as_ref(),
104+
)?;
99105

100106
Ok(())
101107
}
@@ -166,7 +172,12 @@ fn upload_content_blobs(
166172
}
167173

168174
processed = processed.saturating_add(batch.len());
169-
maybe_log_progress("content blobs", processed, artifacts.content_blob_count(), &mut last_percent);
175+
maybe_log_progress(
176+
"content blobs",
177+
processed,
178+
artifacts.content_blob_count(),
179+
&mut last_percent,
180+
);
170181

171182
tx.send(batch)
172183
.map_err(|_| anyhow!("content blob upload worker dropped"))?;
@@ -226,7 +237,10 @@ fn request_needed_content_hashes(
226237
.json()
227238
.context("failed to deserialize content need response")?;
228239

229-
info!(needed = response.missing.len(), "found content hashes to upload");
240+
info!(
241+
needed = response.missing.len(),
242+
"found content hashes to upload"
243+
);
230244
Ok(response.missing.into_iter().collect())
231245
}
232246

@@ -292,7 +306,12 @@ fn upload_unique_chunks(
292306
}
293307

294308
processed = processed.saturating_add(chunks.len());
295-
maybe_log_progress("unique chunks", processed, needed_chunks.len(), &mut last_percent);
309+
maybe_log_progress(
310+
"unique chunks",
311+
processed,
312+
needed_chunks.len(),
313+
&mut last_percent,
314+
);
296315

297316
tx.send(chunks)
298317
.map_err(|_| anyhow!("unique chunk upload worker dropped"))?;
@@ -343,7 +362,12 @@ fn upload_chunk_mappings(
343362
}
344363

345364
processed = processed.saturating_add(batch.len());
346-
maybe_log_progress("chunk mappings", processed, artifacts.chunk_mapping_count(), &mut last_percent);
365+
maybe_log_progress(
366+
"chunk mappings",
367+
processed,
368+
artifacts.chunk_mapping_count(),
369+
&mut last_percent,
370+
);
347371

348372
tx.send(batch)
349373
.map_err(|_| anyhow!("chunk mapping upload worker dropped"))?;
@@ -419,8 +443,8 @@ fn upload_manifest_shards(
419443
"reference_record",
420444
Some(artifacts.reference_record_count()),
421445
|line| {
422-
let record: ReferenceRecord = serde_json::from_str(line)
423-
.context("failed to parse reference record")?;
446+
let record: ReferenceRecord =
447+
serde_json::from_str(line).context("failed to parse reference record")?;
424448
Ok(needed.contains(&record.content_hash))
425449
},
426450
)?;
@@ -728,7 +752,8 @@ fn maybe_log_progress(label: &str, processed: usize, total: usize, last_percent:
728752
if percent > 100 {
729753
percent = 100;
730754
}
731-
let should_log = percent >= last_percent.saturating_add(PROGRESS_STEP_PERCENT) || percent == 100;
755+
let should_log =
756+
percent >= last_percent.saturating_add(PROGRESS_STEP_PERCENT) || percent == 100;
732757

733758
if should_log {
734759
*last_percent = percent;

0 commit comments

Comments
 (0)