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

pinot plugin loader #13907

Closed
wants to merge 10 commits into from

Conversation

rfscholte
Copy link
Contributor

@rfscholte rfscholte commented Aug 29, 2024

This PR must be merged after #13845 and it assumes that #13849 uses the same structure of the zipfile.

@Jackie-Jiang Jackie-Jiang added the dependencies Pull requests that update a dependency file label Aug 29, 2024
@gortiz gortiz changed the title Stp 3364 pinot plugin loader pinot plugin loader Sep 2, 2024
}
}

try (var stream = Files.newDirectoryStream(directory.toPath().resolve("lib"), e -> e.getFileName().toString().endsWith(".jar"))) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Bad news! We cannot use var, given we need to be compatible with Java 11

return urlList;
}

boolean isPluginDirectory(Path p) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add some javadocs here?

Also I'm not sure about the method naming. From the caller's perspective a method called isPluginDirectory looks like something cheap and without side effects, while this method is actually unziping a zip file.

assertTrue(visitor.getPluginDirs().contains(Path.of("src/test/resources/plugins-directory/pinotplugin-1")));
assertTrue(visitor.getPluginDirs().contains(Path.of("src/test/resources/plugins-directory/pinotplugin-2")));
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably checkstyle will complain asking for a new EOL

Comment on lines +36 to +40
@Override
public FileVisitResult visitFileFailed(Path file, IOException exc)
throws IOException {
return super.visitFileFailed(file, exc);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to override this method?

import java.util.HashSet;


class PluginsDirectoryVisitor extends SimpleFileVisitor<Path> {
Copy link
Contributor

@gortiz gortiz Sep 2, 2024

Choose a reason for hiding this comment

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

nit: I don't like having these individual classes that are designed to resolve a problem that is specific to some other class. It is not important, but I would prefer to refactor this class as a inner class of PluginManager.

You would be able then to remove the two attributes (and therefore the constructor)

Comment on lines +20 to +23
public PluginsDirectoryVisitor(PinotPluginHandler _pinotPluginHandler, ShadedPluginHandler _shadedPluginHandler) {
this._pinotPluginHandler = _pinotPluginHandler;
this._shadedPluginHandler = _shadedPluginHandler;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

the code style checker is going to complain about that. Attributes must be prefixed with _ and variables must not be prefixed with _. Also this.attribute is forbidden.

I hate that code style but... one gets used to it :D

@rfscholte
Copy link
Contributor Author

Superseded by #13930

@rfscholte rfscholte closed this Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants