Part of bzrlib.smart.medium View In Hierarchy
Known subclasses: bzrlib.smart.medium.SmartClientStreamMedium, bzrlib.tests.test_remote.FakeMedium, bzrlib.tests.test_smart_transport.MockMedium, bzrlib.transport.http.SmartClientHTTPMedium
Method | __init__ | Undocumented |
Method | protocol_version | Find out if 'hello' smart request works. |
Method | should_probe | Should RemoteBzrDirFormat.probe_transport send a smart request on |
Method | disconnect | If this medium maintains a persistent connection, close it. |
Method | remote_path_from_transport | Convert transport into a path suitable for using in a request. |
Method | _is_remote_before | Is it possible the remote side supports RPCs for a given version? |
Method | _remember_remote_is_before | Tell this medium that the remote side is older the given version. |
Inherited from SmartMedium:
Method | read_bytes | Read some bytes from this medium. |
Method | _push_back | Return unused bytes to the medium, because they belong to the next |
Method | _get_push_back_buffer | Undocumented |
Method | _read_bytes | Undocumented |
Method | _get_line | Read bytes from this request's response until a newline byte. |
Method | _report_activity | Notify that this medium has activity. |
Is it possible the remote side supports RPCs for a given version?
Typical use:
needed_version = (1, 2) if medium._is_remote_before(needed_version): fallback_to_pre_1_2_rpc() else: try: do_1_2_rpc() except UnknownSmartMethod: medium._remember_remote_is_before(needed_version) fallback_to_pre_1_2_rpc()
See Also | _remember_remote_is_before |
See Also | _is_remote_before |
Some transports are unambiguously smart-only; there's no need to check if the transport is able to carry smart requests, because that's all it is for. In those cases, this method should return False.
But some HTTP transports can sometimes fail to carry smart requests, but still be usuable for accessing remote bzrdirs via plain file accesses. So for those transports, their media should return True here so that RemoteBzrDirFormat can determine if it is appropriate for that transport.
The default implementation does nothing.
Note that the resulting remote path doesn't encode the host name or anything but path, so it is only safe to use it in requests sent over the medium from the matching transport.