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

refactor(xlineapi): improve is_conflict #932

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

lxl66566
Copy link
Collaborator

@lxl66566 lxl66566 commented Aug 2, 2024

Please briefly answer these questions:

  • what problem are you trying to solve? (or if there's no problem, what's the motivation for this change?)

  • what changes does this pull request make?

    • use macros to easily add conflict rules
      • There are two types of conflict check rules: one is based on it's type and readable/writable status, and another type is based on the infomation in the request, like lease(). The PR is mainly to solve the first type of check rules.
    • use a global conflict rules cache to cache conflict result based on request type checking
  • are there any non-obvious implications of these changes? (does it break compatibility with previous versions, etc)

@mergify mergify bot requested a review from a team August 2, 2024 01:27
Copy link

codecov bot commented Aug 2, 2024

Codecov Report

Attention: Patch coverage is 78.52761% with 35 lines in your changes missing coverage. Please review.

Project coverage is 75.12%. Comparing base (e35b35a) to head (901357c).
Report is 321 commits behind head on master.

Files with missing lines Patch % Lines
crates/xlineapi/src/classifier.rs 59.37% 26 Missing ⚠️
crates/xline/src/server/command.rs 66.66% 6 Missing and 2 partials ⚠️
crates/xlineapi/src/command.rs 98.64% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #932      +/-   ##
==========================================
- Coverage   75.55%   75.12%   -0.43%     
==========================================
  Files         180      191      +11     
  Lines       26938    28539    +1601     
  Branches    26938    28539    +1601     
==========================================
+ Hits        20353    21441    +1088     
- Misses       5366     5801     +435     
- Partials     1219     1297      +78     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

mergify bot commented Aug 15, 2024

@lxl66566 Your PR is in conflict and cannot be merged.

Copy link

This PR is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 14 days

Copy link

mergify bot commented Oct 13, 2024

@lxl66566 Convert your pr to draft since CI failed

@mergify mergify bot marked this pull request as draft October 13, 2024 15:16
@mergify mergify bot added the CI:fail CI has failed label Oct 13, 2024
@mergify mergify bot marked this pull request as ready for review October 13, 2024 15:31
@mergify mergify bot removed the CI:fail CI has failed label Oct 13, 2024
Comment on lines +3 to +48
/// because RequestWrapper do not repr u8, we need to convert it manually.
impl From<&RequestWrapper> for u8 {
fn from(value: &RequestWrapper) -> Self {
match *value {
RequestWrapper::PutRequest(_) => 0,
RequestWrapper::RangeRequest(_) => 1,
RequestWrapper::DeleteRangeRequest(_) => 2,
RequestWrapper::TxnRequest(_) => 3,
RequestWrapper::CompactionRequest(_) => 4,
RequestWrapper::AuthEnableRequest(_) => 5,
RequestWrapper::AuthDisableRequest(_) => 6,
RequestWrapper::AuthStatusRequest(_) => 7,
RequestWrapper::AuthRoleAddRequest(_) => 8,
RequestWrapper::AuthRoleDeleteRequest(_) => 9,
RequestWrapper::AuthRoleGetRequest(_) => 10,
RequestWrapper::AuthRoleGrantPermissionRequest(_) => 11,
RequestWrapper::AuthRoleListRequest(_) => 12,
RequestWrapper::AuthRoleRevokePermissionRequest(_) => 13,
RequestWrapper::AuthUserAddRequest(_) => 14,
RequestWrapper::AuthUserChangePasswordRequest(_) => 15,
RequestWrapper::AuthUserDeleteRequest(_) => 16,
RequestWrapper::AuthUserGetRequest(_) => 17,
RequestWrapper::AuthUserGrantRoleRequest(_) => 18,
RequestWrapper::AuthUserListRequest(_) => 19,
RequestWrapper::AuthUserRevokeRoleRequest(_) => 20,
RequestWrapper::AuthenticateRequest(_) => 21,
RequestWrapper::LeaseGrantRequest(_) => 22,
RequestWrapper::LeaseRevokeRequest(_) => 23,
RequestWrapper::LeaseLeasesRequest(_) => 24,
RequestWrapper::AlarmRequest(_) => 25,
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Derive #[repr(u8)] in build.rs?

Copy link
Collaborator Author

@lxl66566 lxl66566 Nov 4, 2024

Choose a reason for hiding this comment

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

How to add it? I tried .field_attribute("Command.request_wrapper", ...) but it seems not work. The field str is not match.

Copy link
Collaborator

Choose a reason for hiding this comment

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

.type_attribute("Command.request_wrapper", "#[repr(u8)]")

crates/xlineapi/src/classifier.rs Outdated Show resolved Hide resolved
crates/xlineapi/src/command.rs Outdated Show resolved Hide resolved
@mergify mergify bot requested a review from a team October 30, 2024 01:24
Signed-off-by: lxl66566 <lxl66566@gmail.com>

refactor(xlineapi): complete refactor

Signed-off-by: lxl66566 <lxl66566@gmail.com>
Signed-off-by: lxl66566 <lxl66566@gmail.com>
Copy link

mergify bot commented Nov 4, 2024

@lxl66566 Convert your pr to draft since CI failed

@mergify mergify bot marked this pull request as draft November 4, 2024 06:32
@mergify mergify bot added the CI:fail CI has failed label Nov 4, 2024
Signed-off-by: lxl66566 <lxl66566@gmail.com>
@mergify mergify bot marked this pull request as ready for review November 4, 2024 09:02
@mergify mergify bot removed the CI:fail CI has failed label Nov 4, 2024
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.

improve the maintainability of is_conflict method
2 participants