refactor(rust): drop variable rebinding in s3 cache and bridge config

Also adds the startup_nodes parameter to the _CacheTestHandle.redis stub to match the merged runtime signature

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Yujong Lee 2026-09-21 22:00:09 +00:00
parent 3ebbb2af5b
commit 58ffa8e4ce
3 changed files with 13 additions and 13 deletions

View file

@ -42,16 +42,17 @@ pub struct S3Cache<C: CacheCodec> {
impl<C: CacheCodec> S3Cache<C> {
pub fn new(config: S3CacheConfig, codec: C, runtime: Handle) -> Self {
let mut builder = aws_sdk_s3::Config::builder()
let endpoint_url: Option<String> = config.endpoint.map(|endpoint| endpoint.url);
let base = aws_sdk_s3::Config::builder()
.behavior_version(BehaviorVersion::latest())
.region(Region::new(config.region.clone()))
.credentials_provider(Credentials::new(config.auth))
.request_checksum_calculation(RequestChecksumCalculation::WhenRequired)
.response_checksum_validation(ResponseChecksumValidation::WhenRequired);
let endpoint_url: Option<String> = config.endpoint.map(|endpoint| endpoint.url);
if let Some(url) = &endpoint_url {
builder = builder.endpoint_url(url).force_path_style(true);
}
let builder = match &endpoint_url {
Some(url) => base.endpoint_url(url).force_path_style(true),
None => base,
};
Self {
client: aws_sdk_s3::Client::from_conf(builder.build()),
codec,

View file

@ -642,14 +642,12 @@ fn optional_attribute_chain<'py>(
value: &Bound<'py, PyAny>,
names: &[&str],
) -> PyResult<Option<Bound<'py, PyAny>>> {
let mut current = value.clone();
for name in names {
match optional_attribute(&current, name)? {
Some(next) => current = next,
None => return Ok(None),
}
}
Ok(Some(current))
names
.iter()
.try_fold(Some(value.clone()), |current, name| match current {
Some(current) => optional_attribute(&current, name),
None => Ok(None),
})
}
#[inline(never)]

View file

@ -162,6 +162,7 @@ class _CacheTestHandle:
*,
ttl_seconds: float = 60.0,
namespace: str | None = None,
startup_nodes: Sequence[tuple[str, int]] | None = None,
) -> _CacheTestHandle: ...
@staticmethod
def s3(