INNER CODE UNIT · Python

_target

Altinity/clickhouse-operator · tools/restore_shared_to_replicated.py:179

    def _target(self, key: str) -> tuple[str, str, str]:
        """Return (scheme, host, canonical_uri) for a bucket-relative key."""
        quoted_key = quote(key, safe="/")
        if self.endpoint_url:
            parsed = urllib.parse.urlparse(self.endpoint_url)
            host = parsed.netloc
            if not host:
                raise RuntimeError(
                    f"Invalid --endpoint-url {self.endpoint_url!r}: missing host. "
                    "Use e.g. http://minio:9000 or https://s3.amazonaws.com"
                )
            return parsed.scheme or "https", host, f"/{self.bucket}/{quoted_key}"
        if self.s3_restore_url:
            parsed = urllib.parse.urlparse(self.s3_restore_url)
            host = parsed.netloc
            # Restore URL is the backup root (includes prefix). GET keys are still
            # bucket-relative (prefix + blob); use host/scheme only, path-style.
            path = parsed.path.rstrip("/")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…