-
Notifications
You must be signed in to change notification settings - Fork 370
Conversation
What do you think about a list of accessible commands? Simple as this:
|
import com.iota.iri.conf.IotaConfig; | ||
|
||
public enum Feature { | ||
ATTACH_TO_TANGLE("attachToTange"), |
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.
attachToTange -> attachToTangle
|
||
for (String disabled : configuration.getRemoteLimitApi()) { | ||
switch (disabled) { | ||
case "attachToTange": |
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.
attachToTange -> attachToTangle
Not sure if this is expecting some more commits still. Just pointing out that this should have a form of Also, #1038 is about request limits. |
@jakubcech I just need to add comments and some test cases i think could be useful Good point on the Abstraction of feature names! |
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.
Nice docs
Just a few changes please
* @param instance the instance of this node | ||
* @return A list of features | ||
*/ | ||
public static Feature[] calculateFeatures(Iota instance) { |
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.
Can this receive IotaConfig
?
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.
It could be, but maybe some day we have to calculate features based on external factors outside of the config. Like only enable X if the database is up to date.
Or want to change to that when we have the need for it, and use config for now?
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.
use configs for now
global scope is evil
/** | ||
* Calculates all features for this Iota node | ||
* @param instance the instance of this node | ||
* @return A list of the features in readable name format |
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 are returning an array not a list
|
||
List<String> featureNames = Arrays.stream(features) | ||
.map(feature -> feature.toString()) | ||
.collect(Collectors.toList()); |
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.
it is better to do .toArray(Sting[]::new)
* @param instance the instance of this node | ||
* @return A list of the features in readable name format | ||
*/ | ||
public static String[] calculateFeatureNames(Iota instance) { |
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.
Can this receive IotaConfig?
It doesn't need the whole instance
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.
Can you also add the changes from commit from iotaledger/iri-regression#67 here?
The iri-regression is now part of this repository.
Thanks
Feature[] features = calculateFeatures(instance); | ||
|
||
String[] featureNames = Arrays.stream(features) | ||
.map(feature -> feature.toString()).toArray(String[]::new); |
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.
just a style thing I want to follow
Can you put the toArray
on a new line? like it was before with collect
@@ -22,6 +22,7 @@ Feature: Test API calls on Machine 1 | |||
|appName | | |||
|appVersion | | |||
|duration | | |||
|features | |
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.
indentation
Description
This PR adds a field called
features
to thegetNodeInfo()
API call.It includes a list of features this node has enabled.
All features are calculated after construction of the node, and before loading of the node, through the
Features
enum. This enum also contains all the possible features a node can have.Discussion: What should the actual feature list be?
Fixes #1039
Solves #854
Type of change
How Has This Been Tested?
Checklist: