File tree 2 files changed +7
-22
lines changed
foundationdb/src/directory
2 files changed +7
-22
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ use crate::directory::error::DirectoryError;
18
18
use crate :: directory:: node:: Node ;
19
19
use crate :: future:: FdbSlice ;
20
20
use crate :: tuple:: hca:: HighContentionAllocator ;
21
- use crate :: tuple:: { pack_into , Subspace } ;
21
+ use crate :: tuple:: Subspace ;
22
22
use crate :: { FdbError , FdbResult , Transaction } ;
23
23
use byteorder:: { LittleEndian , WriteBytesExt } ;
24
24
@@ -378,9 +378,10 @@ impl DirectoryLayer {
378
378
379
379
for path_name in paths {
380
380
node_path. push ( path_name. to_owned ( ) ) ;
381
- let mut next_node_key = vec ! [ DEFAULT_SUB_DIRS ] ;
382
- pack_into ( & path_name, & mut next_node_key) ;
383
- subspace = subspace. subspace ( & next_node_key) ;
381
+ subspace = subspace. subspace :: < ( & [ u8 ] , String ) > ( & (
382
+ vec ! [ DEFAULT_SUB_DIRS ] . as_slice ( ) ,
383
+ path_name. to_owned ( ) ,
384
+ ) ) ;
384
385
385
386
let mut node = Node {
386
387
paths : node_path. clone ( ) ,
Original file line number Diff line number Diff line change @@ -96,24 +96,8 @@ impl Node {
96
96
for fdb_value in fdb_values {
97
97
let subspace = Subspace :: from_bytes ( fdb_value. key ( ) ) ;
98
98
// stripping from subspace
99
- let sub_directory: Vec < u8 > = self . node_subspace . unpack ( subspace. bytes ( ) ) ?;
100
- match String :: from_utf8 ( sub_directory. to_owned ( ) ) {
101
- Ok ( mut s) => {
102
- // s is like "\u{0}\u{2}node-0\u{0}"
103
- // we need to remove DEFAULT_SUB_DIRS at the beginning and the padding at the end.
104
- // maybe there is a better way to clean it? Unpack?
105
- s. remove ( 0 ) ;
106
- s. remove ( 0 ) ;
107
- s. remove ( s. len ( ) - 1 ) ;
108
- results. push ( s) ;
109
- }
110
- Err ( err) => {
111
- return Err ( DirectoryError :: Message ( format ! (
112
- "could not decode '{:?}' in utf-8: {}" ,
113
- sub_directory, err
114
- ) ) )
115
- }
116
- }
99
+ let sub_directory: ( Vec < u8 > , String ) = self . node_subspace . unpack ( subspace. bytes ( ) ) ?;
100
+ results. push ( sub_directory. 1 ) ;
117
101
}
118
102
Ok ( results)
119
103
}
You can’t perform that action at this time.
0 commit comments