Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[curve_ops_tool]: add create/delete directory #2035

Closed
Cyber-SiKu opened this issue Nov 4, 2022 · 0 comments
Closed

[curve_ops_tool]: add create/delete directory #2035

Cyber-SiKu opened this issue Nov 4, 2022 · 0 comments
Assignees
Labels
curvebs good first issue Good for newcomers tools Tool improvements

Comments

@Cyber-SiKu
Copy link
Contributor

Is your feature request related to a problem? (你需要的功能是否与某个问题有关?)

We want to add corresponding operations to directories in create/delete of curve_ops_tool.

  • curve_ops_tool create is defined here:
    } else if (cmd == kCreateCmd) {
    return core_->CreateFile(fileName, FLAGS_fileLength * mds::kGB,
    FLAGS_stripeUnit, FLAGS_stripeCount);
    } else if (cmd == kExtendCmd) {
  • curve_ops_tool delete is defined here:
    } else if (cmd == kDeleteCmd) {
    // 单元测试不判断输入
    if (FLAGS_isTest) {
    return core_->DeleteFile(fileName, FLAGS_forcedelete);
    }
    std::cout << "Are you sure you want to delete "
    << fileName << "?" << "(yes/no)" << std::endl;
    std::string str;
    std::cin >> str;
    if (str == "yes") {
    return core_->DeleteFile(fileName, FLAGS_forcedelete);
    } else {
    std::cout << "Delete cancled!" << std::endl;
    return 0;
    }
    } else if (cmd == kCleanRecycleCmd) {
  • protobuf is defined here:
    message CreateFileRequest {
    required string fileName = 1;
    required FileType fileType = 3;
    optional uint64 fileLength = 4;
    required string owner = 2;
    optional string signature = 5;
    required uint64 date = 6;
    optional uint64 stripeUnit = 7;
    optional uint64 stripeCount = 8;
    };
    message CreateFileResponse {
    required StatusCode statusCode = 1;
    }
    message DeleteFileRequest {
    required string fileName = 1;
    required string owner = 2;
    optional string signature = 3;
    required uint64 date = 4;
    optional uint64 fileId = 5;
    optional bool forceDelete = 6;
    };
    message DeleteFileResponse {
    required StatusCode statusCode = 1;
    }
  • The output of the command should look like:
curve_ops_tool create -fileType=dir =filename=/test -userName=test -password=123

Describe the solution you'd like (描述你期望的解决方法)

Add a FLAG_TYPE, the default is file, execute the old logic, when the value is dir, set the fileType of the request to INODE_DIRECTORY.

Describe alternatives you've considered (描述你想到的折衷方案)

Additional context/screenshots (更多上下文/截图)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
curvebs good first issue Good for newcomers tools Tool improvements
Projects
None yet
Development

No branches or pull requests

4 participants