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: create one type for slots set #2459 #2645

Merged
merged 2 commits into from
Feb 23, 2024

Conversation

BorysTheDev
Copy link
Contributor

No description provided.

src/server/cluster/slot_set.h Outdated Show resolved Hide resolved
src/server/cluster/slot_set.h Outdated Show resolved Hide resolved
Comment on lines +645 to +646
options.slot_range = SlotRange{.start = static_cast<SlotId>(start.value()),
.end = static_cast<SlotId>(end.value())};
Copy link
Contributor

Choose a reason for hiding this comment

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

nit (not to this PR): it's parse_slot that should have been fixed instead of the static_cast 😄

Comment on lines +448 to +450
for (SlotId slot = 0; slot <= SlotSet::kMaxSlot; ++slot) {
if (slots.Contains(slot))
args.push_back(absl::StrCat(slot));
Copy link
Contributor

Choose a reason for hiding this comment

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

nit(also not this PR): Wow, this should use slot ranges instead 😵

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also think so, but It will change the interface of the command, so I decided not doing it now


class SlotSet {
public:
static constexpr SlotId kMaxSlot = 0x3FFF;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe it's better to use the number that redis uses in decimal format? 16k something... at least it's recognizable visually

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I prefer hex format)

Copy link
Contributor

@dranikpg dranikpg left a comment

Choose a reason for hiding this comment

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

Last question: is a header/source separation worth it? I assume this type is leaked to many units as cluster config is included in many places. The files is light on includes and functions, so likely not 🤷🏻‍♂️

@BorysTheDev
Copy link
Contributor Author

Yes, I can not reduce number of includes and code is really light so I've decided to make it header only

@BorysTheDev BorysTheDev merged commit 8771ab3 into main Feb 23, 2024
10 checks passed
@BorysTheDev BorysTheDev deleted the one_type_for_slot_range branch February 23, 2024 12:10
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.

None yet

2 participants