From 7ed525ddd11700cc0de09278e201e9b6ee5ae7c6 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Wed, 24 Jun 2026 16:02:19 -0500 Subject: [PATCH] Rename `SynapseConfig` -> `SynapseHomeServerConfig` --- rust/src/config/mod.rs | 9 ++++++++- rust/src/handlers/mod.rs | 4 ++-- rust/src/handlers/versions.rs | 8 +++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/rust/src/config/mod.rs b/rust/src/config/mod.rs index 562beebfc9..709b442895 100644 --- a/rust/src/config/mod.rs +++ b/rust/src/config/mod.rs @@ -18,8 +18,15 @@ use std::str::FromStr; use pyo3::{exceptions::PyRuntimeError, prelude::*}; +/// A Rust-side view of Synapse's Python `HomeServerConfig`. +/// +/// This only mirrors the subset of config that the Rust handlers need, rather +/// than the whole thing. Thanks to `#[derive(FromPyObject)]`, each field is +/// pulled directly off the corresponding attribute of the Python `config` +/// object, so you can populate it in one shot with +/// `homeserver.getattr("config")?.extract()?`. #[derive(FromPyObject, Clone)] -pub struct SynapseConfig { +pub struct SynapseHomeServerConfig { pub room: RoomConfig, pub auth: AuthConfig, pub server: ServerConfig, diff --git a/rust/src/handlers/mod.rs b/rust/src/handlers/mod.rs index 9911443721..d560423166 100644 --- a/rust/src/handlers/mod.rs +++ b/rust/src/handlers/mod.rs @@ -21,7 +21,7 @@ use pyo3::{ Bound, PyResult, Python, }; -use crate::config::SynapseConfig; +use crate::config::SynapseHomeServerConfig; use crate::storage::db::python_db_pool::PythonDatabasePoolWrapper; use crate::storage::store::Store; @@ -37,7 +37,7 @@ impl RustHandlers { #[new] #[pyo3(signature = (homeserver))] pub fn py_new(py: Python<'_>, homeserver: &Bound<'_, PyAny>) -> PyResult { - let config: SynapseConfig = homeserver.getattr("config")?.extract()?; + let config: SynapseHomeServerConfig = homeserver.getattr("config")?.extract()?; // The Twisted reactor, used both to drive our Tokio runtime and to // marshal database work back onto the reactor thread. diff --git a/rust/src/handlers/versions.rs b/rust/src/handlers/versions.rs index fde47f4a33..e46a13a536 100644 --- a/rust/src/handlers/versions.rs +++ b/rust/src/handlers/versions.rs @@ -19,7 +19,7 @@ use pyo3::prelude::*; use pythonize::{pythonize, PythonizeError}; use serde::{Deserialize, Serialize}; -use crate::config::{RoomCreationPreset, SynapseConfig}; +use crate::config::{RoomCreationPreset, SynapseHomeServerConfig}; use crate::deferred::create_deferred; use crate::storage::store::{PerUserExperimentalFeature, Store}; @@ -278,9 +278,11 @@ pub struct UnstableFeatureMap { e2ee_forced_trusted_private: bool, } -/// Convert from [`SynapseConfig`] to the global defaults for unstable features that the +/// Convert from [`SynapseHomeServerConfig`] to the global defaults for unstable features that the /// server supports [`UnstableFeatureMap`] -pub fn synapse_config_to_global_unstable_feature_map(config: &SynapseConfig) -> UnstableFeatureMap { +pub fn synapse_config_to_global_unstable_feature_map( + config: &SynapseHomeServerConfig, +) -> UnstableFeatureMap { UnstableFeatureMap { msc2326: true, msc1756: true,