@@ -32,7 +32,6 @@ impl VssStore {
3232 if key. is_empty ( ) {
3333 return Err ( Error :: new ( ErrorKind :: Other , "Empty key is not allowed" ) ) ;
3434 }
35- // But namespace and sub_namespace can be empty
3635 if namespace. is_empty ( ) {
3736 Ok ( key. to_string ( ) )
3837 } else {
@@ -83,19 +82,22 @@ impl KVStore for VssStore {
8382 store_id : self . store_id . to_string ( ) ,
8483 key : self . build_key ( namespace, sub_namespace, key) ?,
8584 } ;
86- // self.runtime.spawn()
85+
8786 let resp =
8887 tokio:: task:: block_in_place ( || self . runtime . block_on ( self . client . get_object ( & request) ) )
8988 . map_err ( |e| match e {
9089 VssError :: NoSuchKeyError ( ..) => {
9190 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
9493 ) ;
9594 Error :: new ( ErrorKind :: NotFound , msg)
9695 }
9796 _ => {
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+ ) ;
99101 Error :: new ( ErrorKind :: Other , msg)
100102 }
101103 } ) ?;
@@ -117,7 +119,10 @@ impl KVStore for VssStore {
117119
118120 tokio:: task:: block_in_place ( || self . runtime . block_on ( self . client . put_object ( & request) ) )
119121 . 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+ ) ;
121126 Error :: new ( ErrorKind :: Other , msg)
122127 } ) ?;
123128
@@ -139,7 +144,8 @@ impl KVStore for VssStore {
139144
140145 tokio:: task:: block_in_place ( || self . runtime . block_on ( self . client . delete_object ( & request) ) )
141146 . 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) ;
143149 Error :: new ( ErrorKind :: Other , msg)
144150 } ) ?;
145151 Ok ( ( ) )
@@ -152,7 +158,10 @@ impl KVStore for VssStore {
152158 self . runtime . block_on ( self . list_all_keys ( namespace, sub_namespace) )
153159 } )
154160 . 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+ ) ;
156165 Error :: new ( ErrorKind :: Other , msg)
157166 } ) ?;
158167
0 commit comments