store: delete read_file(), update callers to use async version

This commit is contained in:
Martin von Zweigbergk 2025-05-17 09:16:08 -07:00
parent 84f188b91e
commit 12bcd04459
3 changed files with 4 additions and 6 deletions

View File

@ -190,7 +190,9 @@ fn fix_one_file(
// subsequent matching tool gets its input from the previous matching tool's
// output.
let mut old_content = vec![];
let mut read = store.read_file(&file_to_fix.repo_path, &file_to_fix.file_id)?;
let mut read = store
.read_file_async(&file_to_fix.repo_path, &file_to_fix.file_id)
.block_on()?;
read.read_to_end(&mut old_content)?;
let new_content = matching_tools.fold(old_content.clone(), |prev_content, tool_config| {
match run_tool(

View File

@ -234,10 +234,6 @@ impl Store {
Ok(Tree::new(self.clone(), path.to_owned(), tree_id, data))
}
pub fn read_file(&self, path: &RepoPath, id: &FileId) -> BackendResult<Box<dyn Read>> {
self.read_file_async(path, id).block_on()
}
pub async fn read_file_async(
&self,
path: &RepoPath,

View File

@ -370,7 +370,7 @@ pub fn repo_path_buf(value: impl Into<String>) -> RepoPathBuf {
}
pub fn read_file(store: &Store, path: &RepoPath, id: &FileId) -> Vec<u8> {
let mut reader = store.read_file(path, id).unwrap();
let mut reader = store.read_file_async(path, id).block_on().unwrap();
let mut content = vec![];
reader.read_to_end(&mut content).unwrap();
content