-
Notifications
You must be signed in to change notification settings - Fork 34
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 resource discovery code #422
Conversation
resources.push(resource.1); | ||
for (_resource_name, found_resources) in discovered_resources { | ||
for resource in found_resources { | ||
resources.push(resource.clone()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this PR adds multi-version support only for 'List' operation, correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, that's just in preparation for follow-up PR, didn't want to change find_resource
yet
@@ -5,6 +5,8 @@ use crate::{dscresources::dscresource::DscResource, dscerror::DscError}; | |||
use std::collections::BTreeMap; | |||
|
|||
pub trait ResourceDiscovery { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this refactoring PR is a good time to get rid of trait ResourceDiscovery
, since we only have 1 type of resources.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should do that separately and also remove the abstraction above command_resource since we only have that one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created #426
use tracing_indicatif::span_ext::IndicatifSpanExt; | ||
|
||
pub struct CommandDiscovery { | ||
// use BTreeMap so that the results are sorted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please extend the comment to something like :
... so that results are sorted by reousrce type name and vector values - are found resource versions of this type in order of decreasing of semversion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
PR Summary
In preparation to add support for handle multiple and finding specific versions of resource, needed to refactor the existing code.
discover_resources()
to befind_resources()
as that's really what it does based on a filterBecause the changes moves around lots of existing code, might be easier to review the file rather than the diff.