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

Reuse config deserialization logic across filters #182

Merged
merged 1 commit into from
Feb 2, 2021

Conversation

iffyio
Copy link
Collaborator

@iffyio iffyio commented Jan 31, 2021

Updates CreateFilterArgs to contain either static or proto filter
config using an enum.
Add a function to deserialize the config enum, returning the static
version regardless of input type. This function requires that the
static config can be created from the proto type. Update all filters
with proto config type TODO as they do not yet have proto configs.

Updates CreateFilterArgs to contain either static or proto filter
config using an enum.
Add a function to deserialize the config enum, returning the static
version regardless of input type. This function requires that the
static config can be created from the proto type. Update all filters
with proto config type TODO as they do not yet have proto configs.
Copy link
Contributor

@markmandel markmandel left a comment

Choose a reason for hiding this comment

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

Nice!

/// metrics_registry is used to register filter metrics collectors.
pub metrics_registry: Registry,
}

impl CreateFilterArgs<'_> {
pub fn new(config: Option<&serde_yaml::Value>) -> CreateFilterArgs {
pub fn fixed(config: Option<&serde_yaml::Value>) -> CreateFilterArgs {
Copy link
Contributor

@markmandel markmandel Feb 2, 2021

Choose a reason for hiding this comment

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

Shame we can't call it static - I even went to double check it, but it's a keyword!

@markmandel markmandel merged commit dbe56ea into main Feb 2, 2021
@markmandel markmandel deleted the iu/reuse-config-deserialization branch February 2, 2021 03:28
@markmandel markmandel added the kind/cleanup Refactoring code, fixing up documentation, etc label Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes kind/cleanup Refactoring code, fixing up documentation, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants