Part of bzrlib.smart.medium View In Hierarchy
Known subclasses: bzrlib.smart.medium.SmartClientStreamMediumRequest, bzrlib.transport.http.SmartClientHTTPMediumRequest
Each request allows bytes to be provided to it via accept_bytes, and then the response bytes to be read via read_bytes.
For instance: request.accept_bytes('123') request.finished_writing() result = request.read_bytes(3) request.finished_reading()
It is up to the individual SmartClientMedium whether multiple concurrent requests can exist. See SmartClientMedium.get_request to obtain instances of SmartClientMediumRequest, and the concrete Medium you are using for details on concurrency and pipelining.
Method | __init__ | Construct a SmartClientMediumRequest for the medium medium. |
Method | accept_bytes | Accept bytes for inclusion in this request. |
Method | finished_reading | Inform the request that all desired data has been read. |
Method | finished_writing | Finish the writing phase of this request. |
Method | read_bytes | Read bytes from this requests response. |
Method | read_line | Undocumented |
Method | _accept_bytes | Helper for accept_bytes. |
Method | _finished_reading | Helper for finished_reading. |
Method | _finished_writing | Helper for finished_writing. |
Method | _read_bytes | Helper for SmartClientMediumRequest.read_bytes. |
Method | _read_line | Helper for SmartClientMediumRequest.read_line. |
This method may not be called after finished_writing() has been called. It depends upon the Medium whether or not the bytes will be immediately transmitted. Message based Mediums will tend to buffer the bytes until finished_writing() is called.
Parameters | bytes | A bytestring. |
Accept_bytes checks the state of the request to determing if bytes should be accepted. After that it hands off to _accept_bytes to do the actual acceptance.
This will remove the request from the pipeline for its medium (if the medium supports pipelining) and any further calls to methods on the request will raise ReadingCompleted.
finished_reading checks the state of the request to determine if finished_reading is allowed, and if it is hands off to _finished_reading to perform the action.
This will flush all pending data for this request along the medium. After calling finished_writing, you may not call accept_bytes anymore.
finished_writing checks the state of the request to determine if finished_writing is allowed, and if it is hands off to _finished_writing to perform the action.
This method will block and wait for count bytes to be read. It may not be invoked until finished_writing() has been called - this is to ensure a message-based approach to requests, for compatibility with message based mediums like HTTP.
read_bytes checks the state of the request to determing if bytes should be read. After that it hands off to _read_bytes to do the actual read.
By default this forwards to self._medium.read_bytes because we are operating on the medium's stream.
By default this forwards to self._medium._get_line because we are operating on the medium's stream.