Skip to content

feat(scorpio): complete MR layer creation#1233

Merged
Ivanbeethoven merged 1 commit into
gitmono-dev:mainfrom
yyjeqhc:issue_1224
Jul 17, 2025
Merged

feat(scorpio): complete MR layer creation#1233
Ivanbeethoven merged 1 commit into
gitmono-dev:mainfrom
yyjeqhc:issue_1224

Conversation

@yyjeqhc

@yyjeqhc yyjeqhc commented Jul 15, 2025

Copy link
Copy Markdown
Contributor

Resolves #1224
Completed the setup for MR layer support, which includes fetching the files for a single MR and performing differentiated processing.

Copilot AI review requested due to automatic review settings July 15, 2025 11:40
@vercel

vercel Bot commented Jul 15, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mega ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 17, 2025 11:33am

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR completes the MR layer creation by fetching MR file lists, processing file actions (including whiteout for deletions), and downloading necessary files, then integrates this into the daemon's mount handler.

  • build_mr_layer now sets up directories, handles “new”, “modified”, and “deleted” actions, and queues files for download.
  • Added download_mr_files in the fetch module for batch MR file downloads.
  • Updated mount_handler to invoke build_mr_layer, handle errors, and pass MR flag to overlay_mount.

Reviewed Changes

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

Show a summary per file
File Description
scorpio/src/manager/mr.rs Implement MR layer creation logic and action processing.
scorpio/src/manager/fetch.rs Add download_mr_files for concurrent MR file downloads.
scorpio/src/manager/mod.rs Fix duplicate pub mod mr; declarations.
scorpio/src/daemon/mod.rs Invoke MR layer build in mount_handler and propagate errors.
scorpio/src/fuse/mod.rs Reformat overlay_mount calls for readability.
mercury/src/internal/object/commit.rs Remove extraneous blank lines.
mercury/src/internal/object/blob.rs Remove unnecessary blank line.
mercury/src/internal/model/commit.rs Simplify import block formatting.
libra/tests/command/log_test.rs Add missing comma in test struct literal.
libra/src/command/commit.rs Remove trailing blank line.
jupiter/src/service/mod.rs Remove trailing whitespace.
Comments suppressed due to low confidence (3)

scorpio/src/manager/fetch.rs:332

  • [nitpick] Consider adding unit or integration tests for download_mr_files to verify that files are correctly enqueued and downloaded under MR scenarios, ensuring this new functionality is covered.
pub async fn download_mr_files(

scorpio/src/manager/mr.rs:43

  • strip_prefix expects a string slice (&str) pattern; passing a character ('/') may not compile. Use strip_prefix("/") to correctly remove a leading slash.
        let relative_path = file.path.strip_prefix('/').unwrap_or(&file.path);

scorpio/src/manager/mr.rs:55

  • Ensure the action string matches the API specification (original code used "remove"); if the API returns "remove" instead of "deleted", this branch will not be executed and fall into the unknown action case.
            "deleted" => {

Comment thread scorpio/src/manager/mr.rs
config::base_url(),
link
);
async fn fetch_files_list(link: &str) -> Result<FilesListResp, reqwest::Error> {

Copilot AI Jul 17, 2025

Copy link

Choose a reason for hiding this comment

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

The implementation of fetch_files_list no longer calls .send().await, .error_for_status(), or .json(), so it returns a request builder instead of sending the HTTP request and parsing JSON. Restore the request chain to perform the request and deserialize the response.

Copilot uses AI. Check for mistakes.
Comment thread scorpio/src/manager/mr.rs

if result != 0 {
let err = std::io::Error::last_os_error();
eprintln!("Failed to create whiteout file {}: {}", file.path, err);

Copilot AI Jul 17, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] Currently the error when creating a whiteout file is only logged; consider propagating this error via the function's Result to ensure upstream error handling instead of silently continuing.

Suggested change
eprintln!("Failed to create whiteout file {}: {}", file.path, err);
return Err(Box::new(std::io::Error::new(
err.kind(),
format!("Failed to create whiteout file {}: {}", file.path, err),
)));

Copilot uses AI. Check for mistakes.
Comment thread scorpio/src/manager/mr.rs

// Create whiteout as character device with 0/0 device number
// This is the standard way overlay filesystems recognize deleted files
let mode = libc::S_IFCHR | 0o777;

Copilot AI Jul 17, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] The mode 0o777 is a magic number; consider defining a named constant or adding a comment explaining why this permission is chosen to improve readability.

Suggested change
let mode = libc::S_IFCHR | 0o777;
const WHITEOUT_FILE_PERMISSIONS: u32 = 0o777; // Full read, write, and execute permissions for whiteout files
let mode = libc::S_IFCHR | WHITEOUT_FILE_PERMISSIONS;

Copilot uses AI. Check for mistakes.
@Ivanbeethoven
Ivanbeethoven enabled auto-merge July 17, 2025 12:04
@Ivanbeethoven
Ivanbeethoven self-requested a review July 17, 2025 12:05
@Ivanbeethoven
Ivanbeethoven added this pull request to the merge queue Jul 17, 2025
Merged via the queue into gitmono-dev:main with commit 9287e63 Jul 17, 2025
11 of 12 checks passed
liuyangjuncong20202570 pushed a commit to liuyangjuncong20202570/mega that referenced this pull request Jul 20, 2025
@yyjeqhc
yyjeqhc deleted the issue_1224 branch August 4, 2025 08:13
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.

[r2cn] 完善文件系统的挂载功能

3 participants