@@ -67,7 +67,7 @@ impl FilesystemStore {
67
67
}
68
68
}
69
69
70
- fn get_dest_dir_path ( & self , namespace : & str , sub_namespace : & str ) -> std:: io:: Result < PathBuf > {
70
+ fn get_dest_dir_path ( & self , primary_namespace : & str , secondary_namespace : & str ) -> std:: io:: Result < PathBuf > {
71
71
let mut dest_dir_path = {
72
72
#[ cfg( target_os = "windows" ) ]
73
73
{
@@ -81,20 +81,20 @@ impl FilesystemStore {
81
81
}
82
82
} ;
83
83
84
- dest_dir_path. push ( namespace ) ;
85
- if !sub_namespace . is_empty ( ) {
86
- dest_dir_path. push ( sub_namespace ) ;
84
+ dest_dir_path. push ( primary_namespace ) ;
85
+ if !secondary_namespace . is_empty ( ) {
86
+ dest_dir_path. push ( secondary_namespace ) ;
87
87
}
88
88
89
89
Ok ( dest_dir_path)
90
90
}
91
91
}
92
92
93
93
impl KVStore for FilesystemStore {
94
- fn read ( & self , namespace : & str , sub_namespace : & str , key : & str ) -> std:: io:: Result < Vec < u8 > > {
95
- check_namespace_key_validity ( namespace , sub_namespace , Some ( key) , "read" ) ?;
94
+ fn read ( & self , primary_namespace : & str , secondary_namespace : & str , key : & str ) -> std:: io:: Result < Vec < u8 > > {
95
+ check_namespace_key_validity ( primary_namespace , secondary_namespace , Some ( key) , "read" ) ?;
96
96
97
- let mut dest_file_path = self . get_dest_dir_path ( namespace , sub_namespace ) ?;
97
+ let mut dest_file_path = self . get_dest_dir_path ( primary_namespace , secondary_namespace ) ?;
98
98
dest_file_path. push ( key) ;
99
99
100
100
let mut buf = Vec :: new ( ) ;
@@ -114,10 +114,10 @@ impl KVStore for FilesystemStore {
114
114
Ok ( buf)
115
115
}
116
116
117
- fn write ( & self , namespace : & str , sub_namespace : & str , key : & str , buf : & [ u8 ] ) -> std:: io:: Result < ( ) > {
118
- check_namespace_key_validity ( namespace , sub_namespace , Some ( key) , "write" ) ?;
117
+ fn write ( & self , primary_namespace : & str , secondary_namespace : & str , key : & str , buf : & [ u8 ] ) -> std:: io:: Result < ( ) > {
118
+ check_namespace_key_validity ( primary_namespace , secondary_namespace , Some ( key) , "write" ) ?;
119
119
120
- let mut dest_file_path = self . get_dest_dir_path ( namespace , sub_namespace ) ?;
120
+ let mut dest_file_path = self . get_dest_dir_path ( primary_namespace , secondary_namespace ) ?;
121
121
dest_file_path. push ( key) ;
122
122
123
123
let parent_directory = dest_file_path
@@ -201,10 +201,10 @@ impl KVStore for FilesystemStore {
201
201
res
202
202
}
203
203
204
- fn remove ( & self , namespace : & str , sub_namespace : & str , key : & str , lazy : bool ) -> std:: io:: Result < ( ) > {
205
- check_namespace_key_validity ( namespace , sub_namespace , Some ( key) , "remove" ) ?;
204
+ fn remove ( & self , primary_namespace : & str , secondary_namespace : & str , key : & str , lazy : bool ) -> std:: io:: Result < ( ) > {
205
+ check_namespace_key_validity ( primary_namespace , secondary_namespace , Some ( key) , "remove" ) ?;
206
206
207
- let mut dest_file_path = self . get_dest_dir_path ( namespace , sub_namespace ) ?;
207
+ let mut dest_file_path = self . get_dest_dir_path ( primary_namespace , secondary_namespace ) ?;
208
208
dest_file_path. push ( key) ;
209
209
210
210
if !dest_file_path. is_file ( ) {
@@ -290,10 +290,10 @@ impl KVStore for FilesystemStore {
290
290
Ok ( ( ) )
291
291
}
292
292
293
- fn list ( & self , namespace : & str , sub_namespace : & str ) -> std:: io:: Result < Vec < String > > {
294
- check_namespace_key_validity ( namespace , sub_namespace , None , "list" ) ?;
293
+ fn list ( & self , primary_namespace : & str , secondary_namespace : & str ) -> std:: io:: Result < Vec < String > > {
294
+ check_namespace_key_validity ( primary_namespace , secondary_namespace , None , "list" ) ?;
295
295
296
- let prefixed_dest = self . get_dest_dir_path ( namespace , sub_namespace ) ?;
296
+ let prefixed_dest = self . get_dest_dir_path ( primary_namespace , secondary_namespace ) ?;
297
297
let mut keys = Vec :: new ( ) ;
298
298
299
299
if !Path :: new ( & prefixed_dest) . exists ( ) {
@@ -320,17 +320,17 @@ impl KVStore for FilesystemStore {
320
320
321
321
let metadata = p. metadata ( ) ?;
322
322
323
- // We allow the presence of directories in the empty namespace and just skip them.
323
+ // We allow the presence of directories in the empty primary namespace and just skip them.
324
324
if metadata. is_dir ( ) {
325
325
continue ;
326
326
}
327
327
328
328
// If we otherwise don't find a file at the given path something went wrong.
329
329
if !metadata. is_file ( ) {
330
330
debug_assert ! ( false , "Failed to list keys of {}/{}: file couldn't be accessed." ,
331
- PrintableString ( namespace ) , PrintableString ( sub_namespace ) ) ;
331
+ PrintableString ( primary_namespace ) , PrintableString ( secondary_namespace ) ) ;
332
332
let msg = format ! ( "Failed to list keys of {}/{}: file couldn't be accessed." ,
333
- PrintableString ( namespace ) , PrintableString ( sub_namespace ) ) ;
333
+ PrintableString ( primary_namespace ) , PrintableString ( secondary_namespace ) ) ;
334
334
return Err ( std:: io:: Error :: new ( std:: io:: ErrorKind :: Other , msg) ) ;
335
335
}
336
336
@@ -342,17 +342,17 @@ impl KVStore for FilesystemStore {
342
342
}
343
343
} else {
344
344
debug_assert ! ( false , "Failed to list keys of {}/{}: file path is not valid UTF-8" ,
345
- PrintableString ( namespace ) , PrintableString ( sub_namespace ) ) ;
345
+ PrintableString ( primary_namespace ) , PrintableString ( secondary_namespace ) ) ;
346
346
let msg = format ! ( "Failed to list keys of {}/{}: file path is not valid UTF-8" ,
347
- PrintableString ( namespace ) , PrintableString ( sub_namespace ) ) ;
347
+ PrintableString ( primary_namespace ) , PrintableString ( secondary_namespace ) ) ;
348
348
return Err ( std:: io:: Error :: new ( std:: io:: ErrorKind :: Other , msg) ) ;
349
349
}
350
350
}
351
351
Err ( e) => {
352
352
debug_assert ! ( false , "Failed to list keys of {}/{}: {}" ,
353
- PrintableString ( namespace ) , PrintableString ( sub_namespace ) , e) ;
353
+ PrintableString ( primary_namespace ) , PrintableString ( secondary_namespace ) , e) ;
354
354
let msg = format ! ( "Failed to list keys of {}/{}: {}" ,
355
- PrintableString ( namespace ) , PrintableString ( sub_namespace ) , e) ;
355
+ PrintableString ( primary_namespace ) , PrintableString ( secondary_namespace ) , e) ;
356
356
return Err ( std:: io:: Error :: new ( std:: io:: ErrorKind :: Other , msg) ) ;
357
357
}
358
358
}
0 commit comments