refactor(tvix/store): drop mut self borrow in ingest_path
With traverse_to not requiring a &mut anymore, we can drop the &mut self in all these function signatures. Change-Id: I22105376b625cb281c39e92d3206df8a6ce97a88 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8629 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: flokli <flokli@flokli.de>
This commit is contained in:
		
							parent
							
								
									ca06f7061c
								
							
						
					
					
						commit
						fcfbcf9cfa
					
				
					 2 changed files with 6 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -56,7 +56,7 @@ impl From<super::Error> for Error {
 | 
			
		|||
// It assumes the caller adds returned nodes to the directories it assembles.
 | 
			
		||||
#[instrument(skip_all, fields(entry.file_type=?&entry.file_type(),entry.path=?entry.path()))]
 | 
			
		||||
fn process_entry<BS: BlobService, DP: DirectoryPutter>(
 | 
			
		||||
    blob_service: &mut BS,
 | 
			
		||||
    blob_service: &BS,
 | 
			
		||||
    directory_putter: &mut DP,
 | 
			
		||||
    entry: &walkdir::DirEntry,
 | 
			
		||||
    maybe_directory: Option<proto::Directory>,
 | 
			
		||||
| 
						 | 
				
			
			@ -145,8 +145,8 @@ fn process_entry<BS: BlobService, DP: DirectoryPutter>(
 | 
			
		|||
/// naming scheme.
 | 
			
		||||
#[instrument(skip(blob_service, directory_service), fields(path=?p))]
 | 
			
		||||
pub fn ingest_path<BS: BlobService, DS: DirectoryService, P: AsRef<Path> + Debug>(
 | 
			
		||||
    blob_service: &mut BS,
 | 
			
		||||
    directory_service: &mut DS,
 | 
			
		||||
    blob_service: &BS,
 | 
			
		||||
    directory_service: &DS,
 | 
			
		||||
    p: P,
 | 
			
		||||
) -> Result<proto::node::Node, Error> {
 | 
			
		||||
    // Probe if the path points to a symlink. If it does, we process it manually,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -96,7 +96,7 @@ impl<BS: BlobService, DS: DirectoryService, PS: PathInfoService, NCS: NARCalcula
 | 
			
		|||
            }
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        directoryservice::traverse_to(&mut self.directory_service, root_node, sub_path)
 | 
			
		||||
        directoryservice::traverse_to(&self.directory_service, root_node, sub_path)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// Imports a given path on the filesystem into the store, and returns the
 | 
			
		||||
| 
						 | 
				
			
			@ -110,9 +110,8 @@ impl<BS: BlobService, DS: DirectoryService, PS: PathInfoService, NCS: NARCalcula
 | 
			
		|||
        path: &std::path::Path,
 | 
			
		||||
    ) -> Result<crate::proto::PathInfo, io::Error> {
 | 
			
		||||
        // Call [import::ingest_path], which will walk over the given path and return a root_node.
 | 
			
		||||
        let root_node =
 | 
			
		||||
            import::ingest_path(&mut self.blob_service, &mut self.directory_service, path)
 | 
			
		||||
                .expect("error during import_path");
 | 
			
		||||
        let root_node = import::ingest_path(&self.blob_service, &self.directory_service, path)
 | 
			
		||||
            .expect("error during import_path");
 | 
			
		||||
 | 
			
		||||
        // Render the NAR
 | 
			
		||||
        let (nar_size, nar_sha256) = self
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue