Skip to content

Added support for _proxy-filtered flag.#366

Merged
MeirShpilraien merged 3 commits into
masterfrom
support_proxy_filtered_command_flag
Oct 16, 2023
Merged

Added support for _proxy-filtered flag.#366
MeirShpilraien merged 3 commits into
masterfrom
support_proxy_filtered_command_flag

Conversation

@MeirShpilraien
Copy link
Copy Markdown

The new flag is an enterprise only flag. The new flag will make sure the command will not appeared on slow log, command command, and other location where we do not want to expose it.

@MeirShpilraien MeirShpilraien requested a review from iddm October 15, 2023 12:34
Comment thread .circleci/config.yml
Comment on lines +112 to +126
#[derive(Debug, Deserialize)]
pub enum RedisEnterpriseCommandFlags {
/// A special enterprise only flag, make sure the commands marked with this flag will not be expose to
/// user via `command` command or on slow log.
ProxyFiltered,
}

impl From<&RedisEnterpriseCommandFlags> for &'static str {
fn from(value: &RedisEnterpriseCommandFlags) -> Self {
match value {
RedisEnterpriseCommandFlags::ProxyFiltered => "_proxy-filtered",
}
}
}

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.

What do you think about using the bitflags here? P.S. If you decide to use the bitflags, the name should ideally be renamed to avoid the plural form, so the last s should be removed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I follow the none enterprise flags avoid, I do not see what we get by using bitflag, this enum is just for parsing the input of the proc macro.

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.

So, an object of the type RedisEnterpriseCommandFlags may only have one at a time? Even more so, the reason to rename it to Flag instead, in my humble opinion.

About the reasons to use the bitflags - the moment we need to add another variant to this enum - there will be the reason. As long as it is just one flag, not many reasons.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Will rename to Flag

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

On the second thought, RedisCommandFlags is also called Flags. This thing is that those are indeed flags but there is no point of using bitmap, it just for parsing user input.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

When we do not need it as flags we use bitflags, like in here:

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.

When we do not need it as flags we use bitflags, like in here:

The place you referred to should also have it as Flag :-) Look at the examples here. All the enum implementations usually follow the singular naming convention, not the plural. Anyway, I don't insist on not following it. It is just that in the C/C++ world, we always use the plural form, and in Rust - singular, many people get confused when switching between those.

Comment thread redismodule-rs-macros/src/command.rs
Comment thread src/context/commands.rs Outdated
Comment thread src/context/mod.rs Outdated
Comment thread src/context/mod.rs Outdated
Comment thread src/context/commands.rs Outdated
@MeirShpilraien MeirShpilraien requested a review from iddm October 16, 2023 09:03
Comment thread redismodule-rs-macros/src/command.rs
@MeirShpilraien MeirShpilraien requested a review from iddm October 16, 2023 10:56
@MeirShpilraien MeirShpilraien merged commit 6be84d1 into master Oct 16, 2023
@MeirShpilraien MeirShpilraien deleted the support_proxy_filtered_command_flag branch October 16, 2023 13:04
@github-actions github-actions Bot mentioned this pull request May 4, 2026
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.

2 participants