From 22a791d9c77f75ad7c77c1b131e0670c9c27b277 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Tue, 27 Aug 2024 21:44:00 -0600 Subject: [PATCH] Bump collab min version to 0.134 (#16918) 0.05% of requests use a version less than this today; and it lets us get rid of a bunch of versioning we no longer need. Release Notes: - N/A --- crates/collab/src/rpc.rs | 45 ++---------------------- crates/collab/src/rpc/connection_pool.rs | 28 +-------------- 2 files changed, 3 insertions(+), 70 deletions(-) diff --git a/crates/collab/src/rpc.rs b/crates/collab/src/rpc.rs index 8a6867c5e0b15..e703ec7af51fc 100644 --- a/crates/collab/src/rpc.rs +++ b/crates/collab/src/rpc.rs @@ -78,8 +78,6 @@ use tracing::{ info_span, instrument, Instrument, }; -use self::connection_pool::VersionedMessage; - pub const RECONNECT_TIMEOUT: Duration = Duration::from_secs(30); // kubernetes gives terminated pods 10s to shutdown gracefully. After they're gone, we can clean up old resources. @@ -507,7 +505,7 @@ impl Server { forward_mutating_project_request::, )) .add_request_handler(user_handler( - forward_versioned_mutating_project_request::, + forward_mutating_project_request::, )) .add_request_handler(user_handler( forward_mutating_project_request::, @@ -549,7 +547,7 @@ impl Server { forward_mutating_project_request::, )) .add_request_handler(user_handler( - forward_versioned_mutating_project_request::, + forward_mutating_project_request::, )) .add_request_handler(user_handler( forward_mutating_project_request::, @@ -3047,45 +3045,6 @@ where Ok(()) } -/// forward a project request to the host. These requests are disallowed -/// for guests. -async fn forward_versioned_mutating_project_request( - request: T, - response: Response, - session: UserSession, -) -> Result<()> -where - T: EntityMessage + RequestMessage + VersionedMessage, -{ - let project_id = ProjectId::from_proto(request.remote_entity_id()); - - let host_connection_id = session - .db() - .await - .host_for_mutating_project_request(project_id, session.connection_id, session.user_id()) - .await?; - if let Some(host_version) = session - .connection_pool() - .await - .connection(host_connection_id) - .map(|c| c.zed_version) - { - if let Some(min_required_version) = request.required_host_version() { - if min_required_version > host_version { - return Err(anyhow!(ErrorCode::RemoteUpgradeRequired - .with_tag("required", &min_required_version.to_string())))?; - } - } - } - - let payload = session - .peer - .forward_request(session.connection_id, host_connection_id, request) - .await?; - response.send(payload)?; - Ok(()) -} - /// Notify other participants that a new buffer has been created async fn create_buffer_for_peer( request: proto::CreateBufferForPeer, diff --git a/crates/collab/src/rpc/connection_pool.rs b/crates/collab/src/rpc/connection_pool.rs index 52d825f4e0b87..7764f35553ff5 100644 --- a/crates/collab/src/rpc/connection_pool.rs +++ b/crates/collab/src/rpc/connection_pool.rs @@ -32,11 +32,7 @@ impl fmt::Display for ZedVersion { impl ZedVersion { pub fn can_collaborate(&self) -> bool { - self.0 >= SemanticVersion::new(0, 129, 2) - } - - pub fn with_save_as() -> ZedVersion { - ZedVersion(SemanticVersion::new(0, 134, 0)) + self.0 >= SemanticVersion::new(0, 134, 0) } pub fn with_list_directory() -> ZedVersion { @@ -48,28 +44,6 @@ impl ZedVersion { } } -pub trait VersionedMessage { - fn required_host_version(&self) -> Option { - None - } -} - -impl VersionedMessage for proto::SaveBuffer { - fn required_host_version(&self) -> Option { - if self.new_path.is_some() { - Some(ZedVersion::with_save_as()) - } else { - None - } - } -} - -impl VersionedMessage for proto::OpenNewBuffer { - fn required_host_version(&self) -> Option { - Some(ZedVersion::with_save_as()) - } -} - #[derive(Serialize)] pub struct Connection { pub principal_id: PrincipalId,