| @@ -81,10 +81,10 @@ pub trait DelegateBlocking { · 80 unmodified lines |
| 81 | | 81 | |
| 82 | /// A method called repeatedly to negotiate the objects to receive in [`receive_pack(…)`][Delegate::receive_pack()]. | 82 | /// A method called repeatedly to negotiate the objects to receive in [`receive_pack(…)`][Delegate::receive_pack()]. |
| 83 | /// | 83 | /// |
| 84 | /// The first call has `previous` set to `None` as there was no previous response. Every call that follows `previous` | 84 | /// The first call has `previous_response` set to `None` as there was no previous response. Every call that follows `previous_response` |
| 85 | /// will be set to `Some`. | 85 | /// will be set to `Some`. |
| 86 | /// | 86 | /// |
| 87 | /// ### If `previous` is `None`… | 87 | /// ### If `previous_response` is `None`… |
| 88 | /// | 88 | /// |
| 89 | /// Given a list of `arguments` to populate with wants, want-refs, shallows, filters and other contextual information to be | 89 | /// Given a list of `arguments` to populate with wants, want-refs, shallows, filters and other contextual information to be |
| 90 | /// sent to the server. This method is called once. | 90 | /// sent to the server. This method is called once. |
| @@ -97,17 +97,21 @@ pub trait DelegateBlocking { · 6 unmodified lines |
| 97 | /// Return `Action::Close` if you know that there are no `haves` on your end to allow the server to send all of its objects | 97 | /// Return `Action::Close` if you know that there are no `haves` on your end to allow the server to send all of its objects |
| 98 | /// as is the case during initial clones. | 98 | /// as is the case during initial clones. |
| 99 | /// | 99 | /// |
| 100 | /// ### If `previous` is `Some`… | 100 | /// ### If `previous_response` is `Some`… |
| 101 | /// | 101 | /// |
| 102 | /// Populate `arguments` with the objects you `have` starting from the tips of _your_ refs, taking into consideration | 102 | /// Populate `arguments` with the objects you `have` starting from the tips of _your_ refs, taking into consideration |
| 103 | /// the `previous` response of the server to see which objects they acknowledged to have. You have to maintain | 103 | /// the `previous_response` response of the server to see which objects they acknowledged to have. You have to maintain |
| 104 | /// enough state to be able to walk down from your tips on each call, if they are not in common, and keep setting `have` | 104 | /// enough state to be able to walk down from your tips on each call, if they are not in common, and keep setting `have` |
| 105 | /// for those which are in common if that helps teaching the server about our state and to acknowledge their existence on _their_ end. | 105 | /// for those which are in common if that helps teaching the server about our state and to acknowledge their existence on _their_ end. |
| 106 | /// This method is called until the other side signals they are ready to send a pack. | 106 | /// This method is called until the other side signals they are ready to send a pack. |
| 107 | /// Return `Action::Close` if you want to give up before finding a common base. This can happen if the remote repository | 107 | /// Return `Action::Close` if you want to give up before finding a common base. This can happen if the remote repository |
| 108 | /// has radically changed so there are no bases, or they are very far in the past, causing all objects to be sent. | 108 | /// has radically changed so there are no bases, or they are very far in the past, causing all objects to be sent. |
| 109 | fn negotiate(&mut self, refs: &[Ref], arguments: &mut Arguments, previous: Option<&Response>) | 109 | fn negotiate( |
| 110 | -> io::Result<Action>; | 110 | &mut self, |
| | 111 | refs: &[Ref], |
| | 112 | arguments: &mut Arguments, |
| | 113 | previous_response: Option<&Response>, |
| | 114 | ) -> io::Result<Action>; |
| 111 | | 115 | |
| 112 | /// Return true if the server should be informed that the operation is completed and no further commands will be issued | 116 | /// Return true if the server should be informed that the operation is completed and no further commands will be issued |
| 113 | /// at the end of the fetch operation. | 117 | /// at the end of the fetch operation. |
| @@ -151,9 +155,9 @@ impl<T: DelegateBlocking> DelegateBlocking for Box<T> { · 37 unmodified lines |
| 151 | &mut self, | 155 | &mut self, |
| 152 | refs: &[Ref], | 156 | refs: &[Ref], |
| 153 | arguments: &mut Arguments, | 157 | arguments: &mut Arguments, |
| 154 | previous: Option<&Response>, | 158 | previous_response: Option<&Response>, |
| 155 | ) -> io::Result<Action> { | 159 | ) -> io::Result<Action> { |
| 156 | self.deref_mut().negotiate(refs, arguments, previous) | 160 | self.deref_mut().negotiate(refs, arguments, previous_response) |
| 157 | } | 161 | } |
| 158 | } | 162 | } |
| 159 | | 163 | |
| @@ -185,9 +189,9 @@ impl<T: DelegateBlocking> DelegateBlocking for &mut T { · 25 unmodified lines |
| 185 | &mut self, | 189 | &mut self, |
| 186 | refs: &[Ref], | 190 | refs: &[Ref], |
| 187 | arguments: &mut Arguments, | 191 | arguments: &mut Arguments, |
| 188 | previous: Option<&Response>, | 192 | previous_response: Option<&Response>, |
| 189 | ) -> io::Result<Action> { | 193 | ) -> io::Result<Action> { |
| 190 | self.deref_mut().negotiate(refs, arguments, previous) | 194 | self.deref_mut().negotiate(refs, arguments, previous_response) |
| 191 | } | 195 | } |
| 192 | } | 196 | } |
| 193 | | 197 | |
| @@ -212,14 +216,14 @@ mod blocking_io { · 18 unmodified lines |
| 212 | /// | 216 | /// |
| 213 | /// Use `progress` to emit your own progress messages when decoding the pack. | 217 | /// Use `progress` to emit your own progress messages when decoding the pack. |
| 214 | /// | 218 | /// |
| 215 | /// `refs` of the remote side are provided for convenience, along with the parsed `previous` response in case you want | 219 | /// `refs` of the remote side are provided for convenience, along with the parsed `previous_response` response in case you want |
| 216 | /// to check additional acks. | 220 | /// to check additional acks. |
| 217 | fn receive_pack( | 221 | fn receive_pack( |
| 218 | &mut self, | 222 | &mut self, |
| 219 | input: impl io::BufRead, | 223 | input: impl io::BufRead, |
| 220 | progress: impl Progress, | 224 | progress: impl Progress, |
| 221 | refs: &[Ref], | 225 | refs: &[Ref], |
| 222 | previous: &Response, | 226 | previous_response: &Response, |
| 223 | ) -> io::Result<()>; | 227 | ) -> io::Result<()>; |
| 224 | } | 228 | } |
| 225 | | 229 | |
| @@ -229,9 +233,9 @@ mod blocking_io { · 3 unmodified lines |
| 229 | input: impl BufRead, | 233 | input: impl BufRead, |
| 230 | progress: impl Progress, | 234 | progress: impl Progress, |
| 231 | refs: &[Ref], | 235 | refs: &[Ref], |
| 232 | previous: &Response, | 236 | previous_response: &Response, |
| 233 | ) -> io::Result<()> { | 237 | ) -> io::Result<()> { |
| 234 | self.deref_mut().receive_pack(input, progress, refs, previous) | 238 | self.deref_mut().receive_pack(input, progress, refs, previous_response) |
| 235 | } | 239 | } |
| 236 | } | 240 | } |
| 237 | | 241 | |
| @@ -241,9 +245,9 @@ mod blocking_io { · 3 unmodified lines |
| 241 | input: impl BufRead, | 245 | input: impl BufRead, |
| 242 | progress: impl Progress, | 246 | progress: impl Progress, |
| 243 | refs: &[Ref], | 247 | refs: &[Ref], |
| 244 | previous: &Response, | 248 | previous_response: &Response, |
| 245 | ) -> io::Result<()> { | 249 | ) -> io::Result<()> { |
| 246 | self.deref_mut().receive_pack(input, progress, refs, previous) | 250 | self.deref_mut().receive_pack(input, progress, refs, previous_response) |
| 247 | } | 251 | } |
| 248 | } | 252 | } |
| 249 | } | 253 | } |
| @@ -272,14 +276,14 @@ mod async_io { · 22 unmodified lines |
| 272 | /// | 276 | /// |
| 273 | /// Use `progress` to emit your own progress messages when decoding the pack. | 277 | /// Use `progress` to emit your own progress messages when decoding the pack. |
| 274 | /// | 278 | /// |
| 275 | /// `refs` of the remote side are provided for convenience, along with the parsed `previous` response in case you want | 279 | /// `refs` of the remote side are provided for convenience, along with the parsed `previous_response` response in case you want |
| 276 | /// to check additional acks. | 280 | /// to check additional acks. |
| 277 | async fn receive_pack( | 281 | async fn receive_pack( |
| 278 | &mut self, | 282 | &mut self, |
| 279 | input: impl AsyncBufRead + Unpin + 'async_trait, | 283 | input: impl AsyncBufRead + Unpin + 'async_trait, |
| 280 | progress: impl Progress, | 284 | progress: impl Progress, |
| 281 | refs: &[Ref], | 285 | refs: &[Ref], |
| 282 | previous: &Response, | 286 | previous_response: &Response, |
| 283 | ) -> io::Result<()>; | 287 | ) -> io::Result<()>; |
| 284 | } | 288 | } |
| 285 | #[async_trait(?Send)] | 289 | #[async_trait(?Send)] |
| @@ -289,9 +293,11 @@ mod async_io { · 3 unmodified lines |
| 289 | input: impl AsyncBufRead + Unpin + 'async_trait, | 293 | input: impl AsyncBufRead + Unpin + 'async_trait, |
| 290 | progress: impl Progress, | 294 | progress: impl Progress, |
| 291 | refs: &[Ref], | 295 | refs: &[Ref], |
| 292 | previous: &Response, | 296 | previous_response: &Response, |
| 293 | ) -> io::Result<()> { | 297 | ) -> io::Result<()> { |
| 294 | self.deref_mut().receive_pack(input, progress, refs, previous).await | 298 | self.deref_mut() |
| | 299 | .receive_pack(input, progress, refs, previous_response) |
| | 300 | .await |
| 295 | } | 301 | } |
| 296 | } | 302 | } |
| 297 | | 303 | |
| @@ -302,9 +308,11 @@ mod async_io { · 4 unmodified lines |
| 302 | input: impl AsyncBufRead + Unpin + 'async_trait, | 308 | input: impl AsyncBufRead + Unpin + 'async_trait, |
| 303 | progress: impl Progress, | 309 | progress: impl Progress, |
| 304 | refs: &[Ref], | 310 | refs: &[Ref], |
| 305 | previous: &Response, | 311 | previous_response: &Response, |
| 306 | ) -> io::Result<()> { | 312 | ) -> io::Result<()> { |
| 307 | self.deref_mut().receive_pack(input, progress, refs, previous).await | 313 | self.deref_mut() |
| | 314 | .receive_pack(input, progress, refs, previous_response) |
| | 315 | .await |
| 308 | } | 316 | } |
| 309 | } | 317 | } |
| 310 | } | 318 | } |