...
Keeping in mind that command will be described in declarative way all newly created commands will be automatically available and used by all of the features above.
The ComputeTask is a common way for building various cluster management commands with the ability to execute them via Ignite Binary Protocol. Taking into account the current limitations mentioned above the following must be a part of design solution to create a common internal management API:
String
as a key, and String
or String[]
as a value.BinaryObject
. It may be formatted to different string results depending on what type of client is used (e.g. REST, CLI, JMX). ...
...
Flow of command execution:
The following design principles are proposed:
./control.sh --system-view ...
./control.sh --baseline-add ...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
/** */ public interface IgniteCommand<T> extends IgniteCallable<T>, IgniteReducer<T, T> { /** {@inheritDoc} */ @Override public default boolean collect(@Nullable T t)/ A - argument type. // R - result type. // T - task type. Task implements actual command logic. public interface Command<A extends IgniteDataTransferObject, R, T extends ComputeTask<VisorTaskArgument<A>, R>> { public String description(); return true public Class<A> args(); }public Class<T> task(); /** {@inheritDoc} */ @Override public default T reduce() {public void printResult(IgniteDataTransferObject arg, Object res, Consumer<String> printer); boolean experimental(); boolean confirmable(); return null; }Collection<UUID> nodes(Collection<UUID> nodes, A arg); } |
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
/** */ @Command(name@OneOf(value = {"addnodeIds", "nodeId", "allNodes"}, optional commandDescription = "Add nodes to baseline topology."true) public class BaselineAddCommandSystemViewCommandArg implementsextends IgniteCallable<String>IgniteDataTransferObject { /** Auto-injected Ignite instance. */@Positional @IgniteInstanceResource @Argument(description = "Name of privatethe IgniteEx ignite; /** Parameter will be injected on command instantiation. Default comma separation. */ @Parameter(names = {"--nodes", "-n"}, description = "List of baseline nodes to add.")system view which content should be printed." + " Both \"SQL\" and \"Java\" styles of system view name are supported" + private List<String> consistentIds; " /** {@inheritDoc} */ @Override public String call() throws Exception {(e.g. SQL_TABLES and sql.tables will be handled similarly)") private String systemViewName; Collection<BaselineNode> baseline = ignite.cluster().currentBaselineTopology();@Argument( Collection<ClusterNode>description srvs= = ignite.cluster().forServers().nodes(); for (String consistentId : consistentIds) { "ID of the node to get the system view from (deprecated. Use --node-ids instead). If not set, random node will be chosen", ClusterNode node = F.find(srvs, null, new IgnitePredicate<ClusterNode>() { optional = true ) private UUID nodeId; @Override public boolean apply(ClusterNode node) {@Argument( description = "Comma-separated list of nodes IDs to get the system view return node.consistentId().toString().equals(consistentId); from. If not set, random node will be chosen", } optional = true ) private UUID[] })nodeIds; if (node == null)@Argument( description = "Get the system view from all thrownodes. new IllegalArgumentException("Node not found for consistent ID: " + consistentId); If not set, random node will be chosen", optional baseline.add(node);= true }) private ignite.cluster().setBaselineTopology(baseline);boolean allNodes; // The rest of returnthe consistentIds.toString(); }code. } |
The following changes must be introduced to allow new command creation and migration processes:
To be done.
...
Phase-3
// Links to discussions on the devlist, if applicable.
...