History

[protocol #145] Unify the `previous` and `previous_result` parameters…

…to be called `previous_response` instead.

Sebastian Thiel committed 5 years ago

Commit 96f77c71 parent 8dfc9434 files · +42 −34Browse files

Showing the changes to git-protocol/src (1 of 4 files). Show all

Unified · Split

git-protocol/src/fetch/delegate.rs+30−22
@@ -81,10 +81,10 @@ pub trait DelegateBlocking { · 80 unmodified lines
8181
8282 /// A method called repeatedly to negotiate the objects to receive in [`receive_pack(…)`][Delegate::receive_pack()].
8383 ///
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`
8585 /// will be set to `Some`.
8686 ///
87− /// ### If `previous` is `None`…
87+ /// ### If `previous_response` is `None`…
8888 ///
8989 /// Given a list of `arguments` to populate with wants, want-refs, shallows, filters and other contextual information to be
9090 /// sent to the server. This method is called once.
@@ -97,17 +97,21 @@ pub trait DelegateBlocking { · 6 unmodified lines
9797 /// Return `Action::Close` if you know that there are no `haves` on your end to allow the server to send all of its objects
9898 /// as is the case during initial clones.
9999 ///
100− /// ### If `previous` is `Some`…
100+ /// ### If `previous_response` is `Some`…
101101 ///
102102 /// 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
104104 /// enough state to be able to walk down from your tips on each call, if they are not in common, and keep setting `have`
105105 /// for those which are in common if that helps teaching the server about our state and to acknowledge their existence on _their_ end.
106106 /// This method is called until the other side signals they are ready to send a pack.
107107 /// Return `Action::Close` if you want to give up before finding a common base. This can happen if the remote repository
108108 /// 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>)
110− -> io::Result<Action>;
109+ fn negotiate(
110+ &mut self,
111+ refs: &[Ref],
112+ arguments: &mut Arguments,
113+ previous_response: Option<&Response>,
114+ ) -> io::Result<Action>;
111115
112116 /// Return true if the server should be informed that the operation is completed and no further commands will be issued
113117 /// at the end of the fetch operation.
@@ -151,9 +155,9 @@ impl<T: DelegateBlocking> DelegateBlocking for Box<T> { · 37 unmodified lines
151155 &mut self,
152156 refs: &[Ref],
153157 arguments: &mut Arguments,
154− previous: Option<&Response>,
158+ previous_response: Option<&Response>,
155159 ) -> io::Result<Action> {
156− self.deref_mut().negotiate(refs, arguments, previous)
160+ self.deref_mut().negotiate(refs, arguments, previous_response)
157161 }
158162 }
159163
@@ -185,9 +189,9 @@ impl<T: DelegateBlocking> DelegateBlocking for &mut T { · 25 unmodified lines
185189 &mut self,
186190 refs: &[Ref],
187191 arguments: &mut Arguments,
188− previous: Option<&Response>,
192+ previous_response: Option<&Response>,
189193 ) -> io::Result<Action> {
190− self.deref_mut().negotiate(refs, arguments, previous)
194+ self.deref_mut().negotiate(refs, arguments, previous_response)
191195 }
192196 }
193197
@@ -212,14 +216,14 @@ mod blocking_io { · 18 unmodified lines
212216 ///
213217 /// Use `progress` to emit your own progress messages when decoding the pack.
214218 ///
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
216220 /// to check additional acks.
217221 fn receive_pack(
218222 &mut self,
219223 input: impl io::BufRead,
220224 progress: impl Progress,
221225 refs: &[Ref],
222− previous: &Response,
226+ previous_response: &Response,
223227 ) -> io::Result<()>;
224228 }
225229
@@ -229,9 +233,9 @@ mod blocking_io { · 3 unmodified lines
229233 input: impl BufRead,
230234 progress: impl Progress,
231235 refs: &[Ref],
232− previous: &Response,
236+ previous_response: &Response,
233237 ) -> io::Result<()> {
234− self.deref_mut().receive_pack(input, progress, refs, previous)
238+ self.deref_mut().receive_pack(input, progress, refs, previous_response)
235239 }
236240 }
237241
@@ -241,9 +245,9 @@ mod blocking_io { · 3 unmodified lines
241245 input: impl BufRead,
242246 progress: impl Progress,
243247 refs: &[Ref],
244− previous: &Response,
248+ previous_response: &Response,
245249 ) -> io::Result<()> {
246− self.deref_mut().receive_pack(input, progress, refs, previous)
250+ self.deref_mut().receive_pack(input, progress, refs, previous_response)
247251 }
248252 }
249253 }
@@ -272,14 +276,14 @@ mod async_io { · 22 unmodified lines
272276 ///
273277 /// Use `progress` to emit your own progress messages when decoding the pack.
274278 ///
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
276280 /// to check additional acks.
277281 async fn receive_pack(
278282 &mut self,
279283 input: impl AsyncBufRead + Unpin + 'async_trait,
280284 progress: impl Progress,
281285 refs: &[Ref],
282− previous: &Response,
286+ previous_response: &Response,
283287 ) -> io::Result<()>;
284288 }
285289 #[async_trait(?Send)]
@@ -289,9 +293,11 @@ mod async_io { · 3 unmodified lines
289293 input: impl AsyncBufRead + Unpin + 'async_trait,
290294 progress: impl Progress,
291295 refs: &[Ref],
292− previous: &Response,
296+ previous_response: &Response,
293297 ) -> 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
295301 }
296302 }
297303
@@ -302,9 +308,11 @@ mod async_io { · 4 unmodified lines
302308 input: impl AsyncBufRead + Unpin + 'async_trait,
303309 progress: impl Progress,
304310 refs: &[Ref],
305− previous: &Response,
311+ previous_response: &Response,
306312 ) -> 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
308316 }
309317 }
310318 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t