erickguan commented on code in PR #6683:
URL: https://github.com/apache/opendal/pull/6683#discussion_r2437560442
##########
core/src/services/gdrive/writer.rs:
##########
@@ -43,6 +43,32 @@ impl GdriveWriter {
file_id,
}
}
+
+ fn parse_metadata(file: GdriveFile) -> Result<Metadata> {
+ let mut metadata = Metadata::default();
Review Comment:
See a comment in the backend.
##########
core/src/services/gdrive/backend.rs:
##########
@@ -74,11 +74,9 @@ impl Access for GdriveBackend {
Error::new(ErrorKind::Unexpected, "parse content
length").set_source(e)
})?);
}
- if let Some(v) = gdrive_file.modified_time {
- meta = meta.with_last_modified(v.parse::<Timestamp>().map_err(|e| {
- Error::new(ErrorKind::Unexpected, "parse last modified
time").set_source(e)
- })?);
- }
+ meta =
meta.with_last_modified(gdrive_file.modified_time.parse::<Timestamp>().map_err(
Review Comment:
This is a good change addressing the comment.
Now looking at code structure, since you built parse metadata which is good,
move these logic into your function.
The other is that most of this function should be moved into core.rs. It's
okay the core have two stat functions. The newer function can simply be called
gdrive_do_stat, or gdrive_get_metadata. The function returns this metadata.
Remember to extract the mime above as a constant.
##########
core/src/services/gdrive/writer.rs:
##########
@@ -43,6 +43,32 @@ impl GdriveWriter {
file_id,
}
}
+
+ fn parse_metadata(file: GdriveFile) -> Result<Metadata> {
Review Comment:
Move this to core.rs as an associated function or a model.rs. The struct is
entirely encapsulated in core.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]