File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
lightning-persister/src/fs_store Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ use lightning::types::string::PrintableString;
99
1010use std:: collections:: HashMap ;
1111use std:: fs;
12- use std:: io:: { Read , Write } ;
12+ use std:: io:: { ErrorKind , Read , Write } ;
1313use std:: path:: { Path , PathBuf } ;
1414use std:: sync:: atomic:: { AtomicU64 , AtomicUsize , Ordering } ;
1515use std:: sync:: { Arc , Mutex , RwLock } ;
@@ -253,7 +253,11 @@ impl FilesystemStoreInner {
253253 version : u64 , preserve_mtime : bool ,
254254 ) -> lightning:: io:: Result < ( ) > {
255255 let mtime = if preserve_mtime {
256- fs:: metadata ( & dest_file_path) . ok ( ) . and_then ( |m| m. modified ( ) . ok ( ) )
256+ match fs:: metadata ( & dest_file_path) {
257+ Err ( e) if e. kind ( ) == ErrorKind :: NotFound => None ,
258+ Err ( e) => return Err ( e. into ( ) ) ,
259+ Ok ( m) => Some ( m. modified ( ) ?) ,
260+ }
257261 } else {
258262 None
259263 } ;
Original file line number Diff line number Diff line change @@ -146,15 +146,15 @@ impl FilesystemStoreState {
146146 let page_entries: Vec < _ > =
147147 entries. iter ( ) . skip ( start_idx) . take ( PAGE_SIZE ) . cloned ( ) . collect ( ) ;
148148
149- let keys: Vec < String > = page_entries. iter ( ) . map ( |( _, key) | key. clone ( ) ) . collect ( ) ;
150-
151149 // Determine next page token
152150 let next_page_token = if start_idx + PAGE_SIZE < entries. len ( ) {
153151 page_entries. last ( ) . map ( |( mtime, key) | PageToken :: new ( format_page_token ( * mtime, key) ) )
154152 } else {
155153 None
156154 } ;
157155
156+ let keys: Vec < String > = page_entries. into_iter ( ) . map ( |( _, key) | key) . collect ( ) ;
157+
158158 Ok ( PaginatedListResponse { keys, next_page_token } )
159159 }
160160}
You can’t perform that action at this time.
0 commit comments