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

conditionals: now with topological sort #907

Closed

Conversation

tom-wa
Copy link
Contributor

@tom-wa tom-wa commented Aug 31, 2016

Purpose

Added topological sorting

Checklist

  • commit messages are fine (with references to issues)
  • I ran all tests and everything went fine
  • I added unit tests
  • affected documentation is fixed
  • I added code comments, logging, and assertions
  • meta data is updated (e.g. README.md of plugins)

@@ -785,6 +787,129 @@ static CondResult evaluateKey (const Key * meta, const Key * suffixList, Key * p
return TRUE;
}

static KeySet * getDependencies (const char * expr, Key * cur, Key * parentKey)
{
char * localExpr = strdup (expr);
Copy link
Contributor

Choose a reason for hiding this comment

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

please use elektraStrDup.

@markus2330
Copy link
Contributor

Please add unit tests. What else is missing?

@tom-wa
Copy link
Contributor Author

tom-wa commented Sep 6, 2016

Shouldn't this parsing code be part of libmeta (later)?

you are right. currently conditionals is the only plugin that benefits from it though, so let's keep it that way for now, i'll improve it and move it to libmeta later.

What else is missing?

a lot of unit tests, +a few things to discuss:
for now, should the topological sort be used by default or activated by a flag (until it's proven to work) ?
what should be done if there are cyclic dependencies or invalid dependencies ?

@markus2330
Copy link
Contributor

should the topological sort be used by default

I think we should not do this for the next release anyway, but the idea is that it should be default when any calculations are involved.

In longer term we should split the plugin to a validation and a calculation plugin. The calculation should be done at lookup time (see #867). Only the calculation needs correct ordering, for validation the order only matters for better error messages, but is not needed for correctness.

@markus2330 markus2330 added this to the 2.0.0 milestone Nov 27, 2019
@markus2330
Copy link
Contributor

I'll close it. Maybe we can continue this after Elektra 1.0.

@markus2330 markus2330 closed this Nov 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants