Skip to content

Conversation

@reatang
Copy link
Contributor

@reatang reatang commented Nov 28, 2025

Add detailed documentation and comments to the main process.

Copilot AI review requested due to automatic review settings November 28, 2025 15:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds comprehensive documentation to the core S3 service implementation, focusing on the main request processing pipeline. The documentation explains how the service handles S3 protocol requests, including authentication, authorization, routing, and operation execution.

Key changes:

  • Added detailed module-level documentation with usage examples for various HTTP frameworks (Hyper, Axum/Tower)
  • Documented the complete request processing flow with ASCII diagrams
  • Added inline comments explaining critical authentication and routing logic

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 12 comments.

File Description
crates/s3s/src/service.rs Added comprehensive module documentation with usage examples, builder pattern documentation, and test documentation
crates/s3s/src/ops/signature.rs Documented signature verification structures and methods for AWS Signature V2/V4
crates/s3s/src/ops/mod.rs Added extensive documentation for the main request dispatcher, preparation phase, and core processing flow with ASCII diagrams

Comment on lines +236 to +251
// Can customize the authentication provider
pub fn set_auth(&mut self, auth: impl S3Auth) {
self.auth = Some(Box::new(auth));
}

// Can customize the access control
pub fn set_access(&mut self, access: impl S3Access) {
self.access = Some(Box::new(access));
}

// Can customize the route
pub fn set_route(&mut self, route: impl S3Route) {
self.route = Some(Box::new(route));
}

// Can customize the validation by bucket name
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment style is inconsistent. Use /// doc comments instead of // for public API methods to ensure they appear in generated documentation.

Suggested change
// Can customize the authentication provider
pub fn set_auth(&mut self, auth: impl S3Auth) {
self.auth = Some(Box::new(auth));
}
// Can customize the access control
pub fn set_access(&mut self, access: impl S3Access) {
self.access = Some(Box::new(access));
}
// Can customize the route
pub fn set_route(&mut self, route: impl S3Route) {
self.route = Some(Box::new(route));
}
// Can customize the validation by bucket name
/// Can customize the authentication provider
pub fn set_auth(&mut self, auth: impl S3Auth) {
self.auth = Some(Box::new(auth));
}
/// Can customize the access control
pub fn set_access(&mut self, access: impl S3Access) {
self.access = Some(Box::new(access));
}
/// Can customize the route
pub fn set_route(&mut self, route: impl S3Route) {
self.route = Some(Box::new(route));
}
/// Can customize the validation by bucket name

Copilot uses AI. Check for mistakes.
Comment on lines +236 to +251
// Can customize the authentication provider
pub fn set_auth(&mut self, auth: impl S3Auth) {
self.auth = Some(Box::new(auth));
}

// Can customize the access control
pub fn set_access(&mut self, access: impl S3Access) {
self.access = Some(Box::new(access));
}

// Can customize the route
pub fn set_route(&mut self, route: impl S3Route) {
self.route = Some(Box::new(route));
}

// Can customize the validation by bucket name
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment style is inconsistent. Use /// doc comments instead of // for public API methods to ensure they appear in generated documentation.

Suggested change
// Can customize the authentication provider
pub fn set_auth(&mut self, auth: impl S3Auth) {
self.auth = Some(Box::new(auth));
}
// Can customize the access control
pub fn set_access(&mut self, access: impl S3Access) {
self.access = Some(Box::new(access));
}
// Can customize the route
pub fn set_route(&mut self, route: impl S3Route) {
self.route = Some(Box::new(route));
}
// Can customize the validation by bucket name
/// Can customize the authentication provider
pub fn set_auth(&mut self, auth: impl S3Auth) {
self.auth = Some(Box::new(auth));
}
/// Can customize the access control
pub fn set_access(&mut self, access: impl S3Access) {
self.access = Some(Box::new(access));
}
/// Can customize the route
pub fn set_route(&mut self, route: impl S3Route) {
self.route = Some(Box::new(route));
}
/// Can customize the validation by bucket name

Copilot uses AI. Check for mistakes.
Comment on lines +236 to +251
// Can customize the authentication provider
pub fn set_auth(&mut self, auth: impl S3Auth) {
self.auth = Some(Box::new(auth));
}

// Can customize the access control
pub fn set_access(&mut self, access: impl S3Access) {
self.access = Some(Box::new(access));
}

// Can customize the route
pub fn set_route(&mut self, route: impl S3Route) {
self.route = Some(Box::new(route));
}

// Can customize the validation by bucket name
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment style is inconsistent. Use /// doc comments instead of // for public API methods to ensure they appear in generated documentation.

Suggested change
// Can customize the authentication provider
pub fn set_auth(&mut self, auth: impl S3Auth) {
self.auth = Some(Box::new(auth));
}
// Can customize the access control
pub fn set_access(&mut self, access: impl S3Access) {
self.access = Some(Box::new(access));
}
// Can customize the route
pub fn set_route(&mut self, route: impl S3Route) {
self.route = Some(Box::new(route));
}
// Can customize the validation by bucket name
/// Customize the authentication provider.
pub fn set_auth(&mut self, auth: impl S3Auth) {
self.auth = Some(Box::new(auth));
}
/// Customize the access control.
pub fn set_access(&mut self, access: impl S3Access) {
self.access = Some(Box::new(access));
}
/// Customize the route.
pub fn set_route(&mut self, route: impl S3Route) {
self.route = Some(Box::new(route));
}
/// Customize the validation by bucket name.

Copilot uses AI. Check for mistakes.
Comment on lines +236 to +251
// Can customize the authentication provider
pub fn set_auth(&mut self, auth: impl S3Auth) {
self.auth = Some(Box::new(auth));
}

// Can customize the access control
pub fn set_access(&mut self, access: impl S3Access) {
self.access = Some(Box::new(access));
}

// Can customize the route
pub fn set_route(&mut self, route: impl S3Route) {
self.route = Some(Box::new(route));
}

// Can customize the validation by bucket name
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment style is inconsistent. Use /// doc comments instead of // for public API methods to ensure they appear in generated documentation.

Suggested change
// Can customize the authentication provider
pub fn set_auth(&mut self, auth: impl S3Auth) {
self.auth = Some(Box::new(auth));
}
// Can customize the access control
pub fn set_access(&mut self, access: impl S3Access) {
self.access = Some(Box::new(access));
}
// Can customize the route
pub fn set_route(&mut self, route: impl S3Route) {
self.route = Some(Box::new(route));
}
// Can customize the validation by bucket name
/// Customize the authentication provider.
pub fn set_auth(&mut self, auth: impl S3Auth) {
self.auth = Some(Box::new(auth));
}
/// Customize the access control.
pub fn set_access(&mut self, access: impl S3Access) {
self.access = Some(Box::new(access));
}
/// Customize the route.
pub fn set_route(&mut self, route: impl S3Route) {
self.route = Some(Box::new(route));
}
/// Customize the validation by bucket name.

Copilot uses AI. Check for mistakes.
}
}

// Automatically implement hyper framework for S3Service
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The comment says 'Automatically implement' but this is a manual trait implementation. Consider rephrasing to 'Implements hyper::service::Service for S3Service' or similar.

Copilot uses AI. Check for mistakes.
Comment on lines +66 to +89
// Request components
pub req_version: ::http::Version,
pub req_method: &'a Method,
pub req_uri: &'a Uri,
pub req_body: &'a mut Body,

// Parsed headers and query string
pub qs: Option<&'a OrderedQs>,
pub hs: OrderedHeaders<'a>,

// Path information
pub decoded_uri_path: String,
pub vh_bucket: Option<&'a str>,

// Content metadata
pub content_length: Option<u64>,
pub mime: Option<Mime>,
pub decoded_content_length: Option<usize>,

// Output: transformed body after signature processing
pub transformed_body: Option<Body>,
pub multipart: Option<Multipart>,

// Output: trailing headers for chunked uploads
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment style is inconsistent with struct documentation. Use /// doc comments for field groups or individual fields to maintain consistency with the struct-level documentation.

Suggested change
// Request components
pub req_version: ::http::Version,
pub req_method: &'a Method,
pub req_uri: &'a Uri,
pub req_body: &'a mut Body,
// Parsed headers and query string
pub qs: Option<&'a OrderedQs>,
pub hs: OrderedHeaders<'a>,
// Path information
pub decoded_uri_path: String,
pub vh_bucket: Option<&'a str>,
// Content metadata
pub content_length: Option<u64>,
pub mime: Option<Mime>,
pub decoded_content_length: Option<usize>,
// Output: transformed body after signature processing
pub transformed_body: Option<Body>,
pub multipart: Option<Multipart>,
// Output: trailing headers for chunked uploads
/// Request components
pub req_version: ::http::Version,
pub req_method: &'a Method,
pub req_uri: &'a Uri,
pub req_body: &'a mut Body,
/// Parsed headers and query string
pub qs: Option<&'a OrderedQs>,
pub hs: OrderedHeaders<'a>,
/// Path information
pub decoded_uri_path: String,
pub vh_bucket: Option<&'a str>,
/// Content metadata
pub content_length: Option<u64>,
pub mime: Option<Mime>,
pub decoded_content_length: Option<usize>,
/// Output: transformed body after signature processing
pub transformed_body: Option<Body>,
pub multipart: Option<Multipart>,
/// Output: trailing headers for chunked uploads

Copilot uses AI. Check for mistakes.
Comment on lines +66 to +89
// Request components
pub req_version: ::http::Version,
pub req_method: &'a Method,
pub req_uri: &'a Uri,
pub req_body: &'a mut Body,

// Parsed headers and query string
pub qs: Option<&'a OrderedQs>,
pub hs: OrderedHeaders<'a>,

// Path information
pub decoded_uri_path: String,
pub vh_bucket: Option<&'a str>,

// Content metadata
pub content_length: Option<u64>,
pub mime: Option<Mime>,
pub decoded_content_length: Option<usize>,

// Output: transformed body after signature processing
pub transformed_body: Option<Body>,
pub multipart: Option<Multipart>,

// Output: trailing headers for chunked uploads
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment style is inconsistent with struct documentation. Use /// doc comments for field groups or individual fields to maintain consistency with the struct-level documentation.

Suggested change
// Request components
pub req_version: ::http::Version,
pub req_method: &'a Method,
pub req_uri: &'a Uri,
pub req_body: &'a mut Body,
// Parsed headers and query string
pub qs: Option<&'a OrderedQs>,
pub hs: OrderedHeaders<'a>,
// Path information
pub decoded_uri_path: String,
pub vh_bucket: Option<&'a str>,
// Content metadata
pub content_length: Option<u64>,
pub mime: Option<Mime>,
pub decoded_content_length: Option<usize>,
// Output: transformed body after signature processing
pub transformed_body: Option<Body>,
pub multipart: Option<Multipart>,
// Output: trailing headers for chunked uploads
/// Request components
pub req_version: ::http::Version,
pub req_method: &'a Method,
pub req_uri: &'a Uri,
pub req_body: &'a mut Body,
/// Parsed headers and query string
pub qs: Option<&'a OrderedQs>,
pub hs: OrderedHeaders<'a>,
/// Path information
pub decoded_uri_path: String,
pub vh_bucket: Option<&'a str>,
/// Content metadata
pub content_length: Option<u64>,
pub mime: Option<Mime>,
pub decoded_content_length: Option<usize>,
/// Output: transformed body after signature processing
pub transformed_body: Option<Body>,
pub multipart: Option<Multipart>,
/// Output: trailing headers for chunked uploads

Copilot uses AI. Check for mistakes.
Comment on lines +66 to +89
// Request components
pub req_version: ::http::Version,
pub req_method: &'a Method,
pub req_uri: &'a Uri,
pub req_body: &'a mut Body,

// Parsed headers and query string
pub qs: Option<&'a OrderedQs>,
pub hs: OrderedHeaders<'a>,

// Path information
pub decoded_uri_path: String,
pub vh_bucket: Option<&'a str>,

// Content metadata
pub content_length: Option<u64>,
pub mime: Option<Mime>,
pub decoded_content_length: Option<usize>,

// Output: transformed body after signature processing
pub transformed_body: Option<Body>,
pub multipart: Option<Multipart>,

// Output: trailing headers for chunked uploads
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment style is inconsistent with struct documentation. Use /// doc comments for field groups or individual fields to maintain consistency with the struct-level documentation.

Suggested change
// Request components
pub req_version: ::http::Version,
pub req_method: &'a Method,
pub req_uri: &'a Uri,
pub req_body: &'a mut Body,
// Parsed headers and query string
pub qs: Option<&'a OrderedQs>,
pub hs: OrderedHeaders<'a>,
// Path information
pub decoded_uri_path: String,
pub vh_bucket: Option<&'a str>,
// Content metadata
pub content_length: Option<u64>,
pub mime: Option<Mime>,
pub decoded_content_length: Option<usize>,
// Output: transformed body after signature processing
pub transformed_body: Option<Body>,
pub multipart: Option<Multipart>,
// Output: trailing headers for chunked uploads
/// Request components
pub req_version: ::http::Version,
pub req_method: &'a Method,
pub req_uri: &'a Uri,
pub req_body: &'a mut Body,
/// Parsed headers and query string
pub qs: Option<&'a OrderedQs>,
pub hs: OrderedHeaders<'a>,
/// Path information
pub decoded_uri_path: String,
pub vh_bucket: Option<&'a str>,
/// Content metadata
pub content_length: Option<u64>,
pub mime: Option<Mime>,
pub decoded_content_length: Option<usize>,
/// Output: transformed body after signature processing
pub transformed_body: Option<Body>,
pub multipart: Option<Multipart>,
/// Output: trailing headers for chunked uploads

Copilot uses AI. Check for mistakes.
Comment on lines +66 to +89
// Request components
pub req_version: ::http::Version,
pub req_method: &'a Method,
pub req_uri: &'a Uri,
pub req_body: &'a mut Body,

// Parsed headers and query string
pub qs: Option<&'a OrderedQs>,
pub hs: OrderedHeaders<'a>,

// Path information
pub decoded_uri_path: String,
pub vh_bucket: Option<&'a str>,

// Content metadata
pub content_length: Option<u64>,
pub mime: Option<Mime>,
pub decoded_content_length: Option<usize>,

// Output: transformed body after signature processing
pub transformed_body: Option<Body>,
pub multipart: Option<Multipart>,

// Output: trailing headers for chunked uploads
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment style is inconsistent with struct documentation. Use /// doc comments for field groups or individual fields to maintain consistency with the struct-level documentation.

Suggested change
// Request components
pub req_version: ::http::Version,
pub req_method: &'a Method,
pub req_uri: &'a Uri,
pub req_body: &'a mut Body,
// Parsed headers and query string
pub qs: Option<&'a OrderedQs>,
pub hs: OrderedHeaders<'a>,
// Path information
pub decoded_uri_path: String,
pub vh_bucket: Option<&'a str>,
// Content metadata
pub content_length: Option<u64>,
pub mime: Option<Mime>,
pub decoded_content_length: Option<usize>,
// Output: transformed body after signature processing
pub transformed_body: Option<Body>,
pub multipart: Option<Multipart>,
// Output: trailing headers for chunked uploads
/// Request components
pub req_version: ::http::Version,
pub req_method: &'a Method,
pub req_uri: &'a Uri,
pub req_body: &'a mut Body,
/// Parsed headers and query string
pub qs: Option<&'a OrderedQs>,
pub hs: OrderedHeaders<'a>,
/// Path information
pub decoded_uri_path: String,
pub vh_bucket: Option<&'a str>,
/// Content metadata
pub content_length: Option<u64>,
pub mime: Option<Mime>,
pub decoded_content_length: Option<usize>,
/// Output: transformed body after signature processing
pub transformed_body: Option<Body>,
pub multipart: Option<Multipart>,
/// Output: trailing headers for chunked uploads

Copilot uses AI. Check for mistakes.
pub transformed_body: Option<Body>,
pub multipart: Option<Multipart>,

// Output: trailing headers for chunked uploads
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment style is inconsistent with struct documentation. Use /// doc comments for field groups or individual fields to maintain consistency with the struct-level documentation.

Suggested change
// Output: trailing headers for chunked uploads
/// Output: trailing headers for chunked uploads

Copilot uses AI. Check for mistakes.
@Nugine
Copy link
Collaborator

Nugine commented Nov 29, 2025

@copilot Fix previous suggestions about doc comments. And run just ci-rust to make sure the CI passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants