Skip to content

Commit 9dc207f

Browse files
committed
Remove no longer necessary SharedCachingProxy <T>
1 parent 2f57680 commit 9dc207f

File tree

7 files changed

+72
-505
lines changed

7 files changed

+72
-505
lines changed

src/lib.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use tracing::{debug, error, info};
2929
pub use self::config::Config;
3030
pub use self::error::ApplicationError;
3131
pub use self::fifo_cache::FifoCache;
32-
pub use self::proxy_service::{CachingProxy, SharedCachingProxy, range_to_string};
32+
pub use self::proxy_service::{CachingProxy, range_to_string};
3333
pub use self::s3_cache::{CacheKey, CachedObject, S3Cache};
3434
pub use self::statistics::UniqueRequestedObjectsStatisticsTracker;
3535

@@ -132,18 +132,17 @@ where
132132
))
133133
});
134134

135-
// Build caching proxy (wrapped for sharing with metrics writer)
136-
let caching_proxy =
137-
proxy_service::SharedCachingProxy::new(proxy_service::CachingProxy::from_aws_proxy(
138-
proxy,
139-
cache,
140-
config.cache_max_object_size_bytes,
141-
config.cache_dry_run,
142-
));
135+
// Build caching proxy
136+
let caching_proxy = proxy_service::CachingProxy::from_aws_proxy(
137+
proxy,
138+
cache,
139+
config.cache_max_object_size_bytes,
140+
config.cache_dry_run,
141+
);
143142

144143
// Build S3 service with auth
145144
let service = {
146-
let mut b = S3ServiceBuilder::new(caching_proxy.clone());
145+
let mut b = S3ServiceBuilder::new(caching_proxy);
147146
b.set_auth(auth::create_auth(&config));
148147
b.build()
149148
};

src/proxy_service.rs

Lines changed: 0 additions & 167 deletions
Original file line numberDiff line numberDiff line change
@@ -614,170 +614,3 @@ impl<T: S3 + Send + Sync> S3 for CachingProxy<T> {
614614
self.inner.upload_part_copy(req).await
615615
}
616616
}
617-
618-
/// Thread-safe shared wrapper around [`CachingProxy`].
619-
///
620-
/// Wraps the proxy in an [`Arc`] to allow sharing between the S3 service handler
621-
/// and other components like the metrics writer.
622-
pub struct SharedCachingProxy<T>(Arc<CachingProxy<T>>);
623-
624-
impl<T> SharedCachingProxy<T> {
625-
/// Wraps a caching proxy for shared access.
626-
pub fn new(proxy: CachingProxy<T>) -> Self {
627-
Self(Arc::new(proxy))
628-
}
629-
630-
/// Returns a clone of the inner [`Arc<CachingProxy<T>>`].
631-
pub fn clone_arc(&self) -> Arc<CachingProxy<T>> {
632-
self.0.clone()
633-
}
634-
}
635-
636-
impl<T> Clone for SharedCachingProxy<T> {
637-
fn clone(&self) -> Self {
638-
Self(self.0.clone())
639-
}
640-
}
641-
642-
#[async_trait::async_trait]
643-
impl<T: S3 + Send + Sync> S3 for SharedCachingProxy<T> {
644-
async fn get_object(
645-
&self,
646-
req: S3Request<GetObjectInput>,
647-
) -> S3Result<S3Response<GetObjectOutput>> {
648-
self.0.get_object(req).await
649-
}
650-
651-
async fn put_object(
652-
&self,
653-
req: S3Request<PutObjectInput>,
654-
) -> S3Result<S3Response<PutObjectOutput>> {
655-
self.0.put_object(req).await
656-
}
657-
658-
async fn delete_object(
659-
&self,
660-
req: S3Request<DeleteObjectInput>,
661-
) -> S3Result<S3Response<DeleteObjectOutput>> {
662-
self.0.delete_object(req).await
663-
}
664-
665-
async fn delete_objects(
666-
&self,
667-
req: S3Request<DeleteObjectsInput>,
668-
) -> S3Result<S3Response<DeleteObjectsOutput>> {
669-
self.0.delete_objects(req).await
670-
}
671-
672-
async fn copy_object(
673-
&self,
674-
req: S3Request<CopyObjectInput>,
675-
) -> S3Result<S3Response<CopyObjectOutput>> {
676-
self.0.copy_object(req).await
677-
}
678-
679-
async fn head_object(
680-
&self,
681-
req: S3Request<HeadObjectInput>,
682-
) -> S3Result<S3Response<HeadObjectOutput>> {
683-
self.0.head_object(req).await
684-
}
685-
686-
async fn create_multipart_upload(
687-
&self,
688-
req: S3Request<CreateMultipartUploadInput>,
689-
) -> S3Result<S3Response<CreateMultipartUploadOutput>> {
690-
self.0.create_multipart_upload(req).await
691-
}
692-
693-
async fn complete_multipart_upload(
694-
&self,
695-
req: S3Request<CompleteMultipartUploadInput>,
696-
) -> S3Result<S3Response<CompleteMultipartUploadOutput>> {
697-
self.0.complete_multipart_upload(req).await
698-
}
699-
700-
async fn abort_multipart_upload(
701-
&self,
702-
req: S3Request<AbortMultipartUploadInput>,
703-
) -> S3Result<S3Response<AbortMultipartUploadOutput>> {
704-
self.0.abort_multipart_upload(req).await
705-
}
706-
707-
async fn list_objects(
708-
&self,
709-
req: S3Request<ListObjectsInput>,
710-
) -> S3Result<S3Response<ListObjectsOutput>> {
711-
self.0.list_objects(req).await
712-
}
713-
714-
async fn list_objects_v2(
715-
&self,
716-
req: S3Request<ListObjectsV2Input>,
717-
) -> S3Result<S3Response<ListObjectsV2Output>> {
718-
self.0.list_objects_v2(req).await
719-
}
720-
721-
async fn list_parts(
722-
&self,
723-
req: S3Request<ListPartsInput>,
724-
) -> S3Result<S3Response<ListPartsOutput>> {
725-
self.0.list_parts(req).await
726-
}
727-
728-
async fn upload_part(
729-
&self,
730-
req: S3Request<UploadPartInput>,
731-
) -> S3Result<S3Response<UploadPartOutput>> {
732-
self.0.upload_part(req).await
733-
}
734-
735-
async fn upload_part_copy(
736-
&self,
737-
req: S3Request<UploadPartCopyInput>,
738-
) -> S3Result<S3Response<UploadPartCopyOutput>> {
739-
self.0.upload_part_copy(req).await
740-
}
741-
742-
async fn create_bucket(
743-
&self,
744-
req: S3Request<CreateBucketInput>,
745-
) -> S3Result<S3Response<CreateBucketOutput>> {
746-
self.0.create_bucket(req).await
747-
}
748-
749-
async fn list_buckets(
750-
&self,
751-
req: S3Request<ListBucketsInput>,
752-
) -> S3Result<S3Response<ListBucketsOutput>> {
753-
self.0.list_buckets(req).await
754-
}
755-
756-
async fn delete_bucket(
757-
&self,
758-
req: S3Request<DeleteBucketInput>,
759-
) -> S3Result<S3Response<DeleteBucketOutput>> {
760-
self.0.delete_bucket(req).await
761-
}
762-
763-
async fn get_bucket_location(
764-
&self,
765-
req: S3Request<GetBucketLocationInput>,
766-
) -> S3Result<S3Response<GetBucketLocationOutput>> {
767-
self.0.get_bucket_location(req).await
768-
}
769-
770-
async fn head_bucket(
771-
&self,
772-
req: S3Request<HeadBucketInput>,
773-
) -> S3Result<S3Response<HeadBucketOutput>> {
774-
self.0.head_bucket(req).await
775-
}
776-
777-
async fn list_multipart_uploads(
778-
&self,
779-
req: S3Request<ListMultipartUploadsInput>,
780-
) -> S3Result<S3Response<ListMultipartUploadsOutput>> {
781-
self.0.list_multipart_uploads(req).await
782-
}
783-
}

0 commit comments

Comments
 (0)