File tree Expand file tree Collapse file tree
subprojects/crates/nix-utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,7 +25,6 @@ rust::String get_build_dir();
2525rust::String get_log_dir ();
2626rust::String get_state_dir ();
2727
28- bool is_valid_path (const StoreWrapper &wrapper, rust::Str path);
2928InternalPathInfo query_path_info (const StoreWrapper &wrapper, rust::Str path);
3029void clear_path_info_cache (const StoreWrapper &wrapper);
3130uint64_t compute_closure_size (const StoreWrapper &wrapper, rust::Str path);
Original file line number Diff line number Diff line change @@ -136,7 +136,6 @@ mod ffi {
136136 fn get_log_dir ( ) -> String ;
137137 fn get_state_dir ( ) -> String ;
138138
139- fn is_valid_path ( store : & StoreWrapper , path : & str ) -> Result < bool > ;
140139 fn query_path_info ( store : & StoreWrapper , path : & str ) -> Result < InternalPathInfo > ;
141140 fn compute_closure_size ( store : & StoreWrapper , path : & str ) -> Result < u64 > ;
142141 fn clear_path_info_cache ( store : & StoreWrapper ) -> Result < ( ) > ;
@@ -551,11 +550,14 @@ where
551550impl BaseStore for BaseStoreImpl {
552551 #[ inline]
553552 async fn is_valid_path ( & self , path : & StorePath ) -> bool {
554- let store = self . wrapper . clone ( ) ;
555553 let path = self . print_store_path ( path) ;
556- asyncify ( move || ffi:: is_valid_path ( store. as_raw ( ) , & path) )
557- . await
558- . unwrap_or ( false )
554+ asyncify_anyhow ( move || -> Result < bool , Error > {
555+ let mut nbs = open_nbs_store ( ) ?;
556+ let nbs_path = nbs. parse_store_path ( & path) . map_err ( Error :: Anyhow ) ?;
557+ Ok ( nbs. is_valid_path ( & nbs_path) )
558+ } )
559+ . await
560+ . unwrap_or ( false )
559561 }
560562
561563 #[ inline]
Original file line number Diff line number Diff line change @@ -65,11 +65,6 @@ rust::String get_build_dir() {
6565rust::String get_log_dir () { return nix::settings.getLogFileSettings ().nixLogDir .string (); }
6666rust::String get_state_dir () { return nix::settings.nixStateDir .string (); }
6767
68- bool is_valid_path (const StoreWrapper &wrapper, rust::Str path) {
69- auto store = wrapper._store ;
70- return store->isValidPath (store->parseStorePath (AS_VIEW (path)));
71- }
72-
7368InternalPathInfo query_path_info (const StoreWrapper &wrapper, rust::Str path) {
7469 auto store = wrapper._store ;
7570 auto info = store->queryPathInfo (store->parseStorePath (AS_VIEW (path)));
You can’t perform that action at this time.
0 commit comments