@@ -67,124 +67,131 @@ impl<E> Clone for Box<dyn DbPool<Error = E>> {
6767pub trait Db : Debug {
6868 type Error : DbErrorIntrospect + ' static ;
6969
70- fn lock_for_read ( & self , params : params:: LockCollection ) -> DbFuture < ' _ , ( ) , Self :: Error > ;
70+ fn lock_for_read ( & mut self , params : params:: LockCollection ) -> DbFuture < ' _ , ( ) , Self :: Error > ;
7171
72- fn lock_for_write ( & self , params : params:: LockCollection ) -> DbFuture < ' _ , ( ) , Self :: Error > ;
72+ fn lock_for_write ( & mut self , params : params:: LockCollection ) -> DbFuture < ' _ , ( ) , Self :: Error > ;
7373
74- fn begin ( & self , for_write : bool ) -> DbFuture < ' _ , ( ) , Self :: Error > ;
74+ fn begin ( & mut self , for_write : bool ) -> DbFuture < ' _ , ( ) , Self :: Error > ;
7575
76- fn commit ( & self ) -> DbFuture < ' _ , ( ) , Self :: Error > ;
76+ fn commit ( & mut self ) -> DbFuture < ' _ , ( ) , Self :: Error > ;
7777
78- fn rollback ( & self ) -> DbFuture < ' _ , ( ) , Self :: Error > ;
78+ fn rollback ( & mut self ) -> DbFuture < ' _ , ( ) , Self :: Error > ;
7979
8080 fn get_collection_timestamps (
81- & self ,
81+ & mut self ,
8282 params : params:: GetCollectionTimestamps ,
8383 ) -> DbFuture < ' _ , results:: GetCollectionTimestamps , Self :: Error > ;
8484
8585 fn get_collection_timestamp (
86- & self ,
86+ & mut self ,
8787 params : params:: GetCollectionTimestamp ,
8888 ) -> DbFuture < ' _ , results:: GetCollectionTimestamp , Self :: Error > ;
8989
9090 fn get_collection_counts (
91- & self ,
91+ & mut self ,
9292 params : params:: GetCollectionCounts ,
9393 ) -> DbFuture < ' _ , results:: GetCollectionCounts , Self :: Error > ;
9494
9595 fn get_collection_usage (
96- & self ,
96+ & mut self ,
9797 params : params:: GetCollectionUsage ,
9898 ) -> DbFuture < ' _ , results:: GetCollectionUsage , Self :: Error > ;
9999
100100 fn get_storage_timestamp (
101- & self ,
101+ & mut self ,
102102 params : params:: GetStorageTimestamp ,
103103 ) -> DbFuture < ' _ , results:: GetStorageTimestamp , Self :: Error > ;
104104
105105 fn get_storage_usage (
106- & self ,
106+ & mut self ,
107107 params : params:: GetStorageUsage ,
108108 ) -> DbFuture < ' _ , results:: GetStorageUsage , Self :: Error > ;
109109
110110 fn get_quota_usage (
111- & self ,
111+ & mut self ,
112112 params : params:: GetQuotaUsage ,
113113 ) -> DbFuture < ' _ , results:: GetQuotaUsage , Self :: Error > ;
114114
115115 fn delete_storage (
116- & self ,
116+ & mut self ,
117117 params : params:: DeleteStorage ,
118118 ) -> DbFuture < ' _ , results:: DeleteStorage , Self :: Error > ;
119119
120120 fn delete_collection (
121- & self ,
121+ & mut self ,
122122 params : params:: DeleteCollection ,
123123 ) -> DbFuture < ' _ , results:: DeleteCollection , Self :: Error > ;
124124
125125 fn delete_bsos (
126- & self ,
126+ & mut self ,
127127 params : params:: DeleteBsos ,
128128 ) -> DbFuture < ' _ , results:: DeleteBsos , Self :: Error > ;
129129
130- fn get_bsos ( & self , params : params:: GetBsos ) -> DbFuture < ' _ , results:: GetBsos , Self :: Error > ;
130+ fn get_bsos ( & mut self , params : params:: GetBsos ) -> DbFuture < ' _ , results:: GetBsos , Self :: Error > ;
131131
132- fn get_bso_ids ( & self , params : params:: GetBsos )
133- -> DbFuture < ' _ , results:: GetBsoIds , Self :: Error > ;
132+ fn get_bso_ids (
133+ & mut self ,
134+ params : params:: GetBsos ,
135+ ) -> DbFuture < ' _ , results:: GetBsoIds , Self :: Error > ;
134136
135- fn post_bsos ( & self , params : params:: PostBsos ) -> DbFuture < ' _ , results:: PostBsos , Self :: Error > ;
137+ fn post_bsos (
138+ & mut self ,
139+ params : params:: PostBsos ,
140+ ) -> DbFuture < ' _ , results:: PostBsos , Self :: Error > ;
136141
137142 fn delete_bso (
138- & self ,
143+ & mut self ,
139144 params : params:: DeleteBso ,
140145 ) -> DbFuture < ' _ , results:: DeleteBso , Self :: Error > ;
141146
142- fn get_bso ( & self , params : params:: GetBso )
143- -> DbFuture < ' _ , Option < results:: GetBso > , Self :: Error > ;
147+ fn get_bso (
148+ & mut self ,
149+ params : params:: GetBso ,
150+ ) -> DbFuture < ' _ , Option < results:: GetBso > , Self :: Error > ;
144151
145152 fn get_bso_timestamp (
146- & self ,
153+ & mut self ,
147154 params : params:: GetBsoTimestamp ,
148155 ) -> DbFuture < ' _ , results:: GetBsoTimestamp , Self :: Error > ;
149156
150- fn put_bso ( & self , params : params:: PutBso ) -> DbFuture < ' _ , results:: PutBso , Self :: Error > ;
157+ fn put_bso ( & mut self , params : params:: PutBso ) -> DbFuture < ' _ , results:: PutBso , Self :: Error > ;
151158
152159 fn create_batch (
153- & self ,
160+ & mut self ,
154161 params : params:: CreateBatch ,
155162 ) -> DbFuture < ' _ , results:: CreateBatch , Self :: Error > ;
156163
157164 fn validate_batch (
158- & self ,
165+ & mut self ,
159166 params : params:: ValidateBatch ,
160167 ) -> DbFuture < ' _ , results:: ValidateBatch , Self :: Error > ;
161168
162169 fn append_to_batch (
163- & self ,
170+ & mut self ,
164171 params : params:: AppendToBatch ,
165172 ) -> DbFuture < ' _ , results:: AppendToBatch , Self :: Error > ;
166173
167174 fn get_batch (
168- & self ,
175+ & mut self ,
169176 params : params:: GetBatch ,
170177 ) -> DbFuture < ' _ , Option < results:: GetBatch > , Self :: Error > ;
171178
172179 fn commit_batch (
173- & self ,
180+ & mut self ,
174181 params : params:: CommitBatch ,
175182 ) -> DbFuture < ' _ , results:: CommitBatch , Self :: Error > ;
176183
177184 fn box_clone ( & self ) -> Box < dyn Db < Error = Self :: Error > > ;
178185
179- fn check ( & self ) -> DbFuture < ' _ , results:: Check , Self :: Error > ;
186+ fn check ( & mut self ) -> DbFuture < ' _ , results:: Check , Self :: Error > ;
180187
181188 fn get_connection_info ( & self ) -> results:: ConnectionInfo ;
182189
183190 /// Retrieve the timestamp for an item/collection
184191 ///
185192 /// Modeled on the Python `get_resource_timestamp` function.
186193 fn extract_resource (
187- & self ,
194+ & mut self ,
188195 user_id : UserIdentifier ,
189196 collection : Option < String > ,
190197 bso : Option < String > ,
@@ -230,22 +237,22 @@ pub trait Db: Debug {
230237
231238 // Internal methods used by the db tests
232239
233- fn get_collection_id ( & self , name : String ) -> DbFuture < ' _ , i32 , Self :: Error > ;
240+ fn get_collection_id ( & mut self , name : String ) -> DbFuture < ' _ , i32 , Self :: Error > ;
234241
235- fn create_collection ( & self , name : String ) -> DbFuture < ' _ , i32 , Self :: Error > ;
242+ fn create_collection ( & mut self , name : String ) -> DbFuture < ' _ , i32 , Self :: Error > ;
236243
237244 fn update_collection (
238- & self ,
245+ & mut self ,
239246 params : params:: UpdateCollection ,
240247 ) -> DbFuture < ' _ , SyncTimestamp , Self :: Error > ;
241248
242249 fn timestamp ( & self ) -> SyncTimestamp ;
243250
244- fn set_timestamp ( & self , timestamp : SyncTimestamp ) ;
251+ fn set_timestamp ( & mut self , timestamp : SyncTimestamp ) ;
245252
246- fn delete_batch ( & self , params : params:: DeleteBatch ) -> DbFuture < ' _ , ( ) , Self :: Error > ;
253+ fn delete_batch ( & mut self , params : params:: DeleteBatch ) -> DbFuture < ' _ , ( ) , Self :: Error > ;
247254
248- fn clear_coll_cache ( & self ) -> DbFuture < ' _ , ( ) , Self :: Error > ;
255+ fn clear_coll_cache ( & mut self ) -> DbFuture < ' _ , ( ) , Self :: Error > ;
249256
250257 fn set_quota ( & mut self , enabled : bool , limit : usize , enforce : bool ) ;
251258}
0 commit comments