@@ -32,7 +32,6 @@ impl VssStore {
32
32
if key. is_empty ( ) {
33
33
return Err ( Error :: new ( ErrorKind :: Other , "Empty key is not allowed" ) ) ;
34
34
}
35
- // But namespace and sub_namespace can be empty
36
35
if namespace. is_empty ( ) {
37
36
Ok ( key. to_string ( ) )
38
37
} else {
@@ -83,19 +82,22 @@ impl KVStore for VssStore {
83
82
store_id : self . store_id . to_string ( ) ,
84
83
key : self . build_key ( namespace, sub_namespace, key) ?,
85
84
} ;
86
- // self.runtime.spawn()
85
+
87
86
let resp =
88
87
tokio:: task:: block_in_place ( || self . runtime . block_on ( self . client . get_object ( & request) ) )
89
88
. map_err ( |e| match e {
90
89
VssError :: NoSuchKeyError ( ..) => {
91
90
let msg = format ! (
92
- "Failed to read as key could not be found: {}/{}. Details: {}" ,
93
- namespace, key, e
91
+ "Failed to read as key could not be found: {}/{}/{} . Details: {}" ,
92
+ namespace, sub_namespace , key, e
94
93
) ;
95
94
Error :: new ( ErrorKind :: NotFound , msg)
96
95
}
97
96
_ => {
98
- let msg = format ! ( "Failed to read from key {}/{}: {}" , namespace, key, e) ;
97
+ let msg = format ! (
98
+ "Failed to read from key {}/{}/{}: {}" ,
99
+ namespace, sub_namespace, key, e
100
+ ) ;
99
101
Error :: new ( ErrorKind :: Other , msg)
100
102
}
101
103
} ) ?;
@@ -117,7 +119,10 @@ impl KVStore for VssStore {
117
119
118
120
tokio:: task:: block_in_place ( || self . runtime . block_on ( self . client . put_object ( & request) ) )
119
121
. map_err ( |e| {
120
- let msg = format ! ( "Failed to write to key {}/{}: {}" , namespace, key, e) ;
122
+ let msg = format ! (
123
+ "Failed to write to key {}/{}/{}: {}" ,
124
+ namespace, sub_namespace, key, e
125
+ ) ;
121
126
Error :: new ( ErrorKind :: Other , msg)
122
127
} ) ?;
123
128
@@ -139,7 +144,8 @@ impl KVStore for VssStore {
139
144
140
145
tokio:: task:: block_in_place ( || self . runtime . block_on ( self . client . delete_object ( & request) ) )
141
146
. map_err ( |e| {
142
- let msg = format ! ( "Failed to delete key {}/{}: {}" , namespace, key, e) ;
147
+ let msg =
148
+ format ! ( "Failed to delete key {}/{}/{}: {}" , namespace, sub_namespace, key, e) ;
143
149
Error :: new ( ErrorKind :: Other , msg)
144
150
} ) ?;
145
151
Ok ( ( ) )
@@ -152,7 +158,10 @@ impl KVStore for VssStore {
152
158
self . runtime . block_on ( self . list_all_keys ( namespace, sub_namespace) )
153
159
} )
154
160
. map_err ( |e| {
155
- let msg = format ! ( "Failed to retrieve keys in namespace: {} : {}" , namespace, e) ;
161
+ let msg = format ! (
162
+ "Failed to retrieve keys in namespace: {}/{} : {}" ,
163
+ namespace, sub_namespace, e
164
+ ) ;
156
165
Error :: new ( ErrorKind :: Other , msg)
157
166
} ) ?;
158
167
0 commit comments