Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
titleBaselineAddCommand.class
linenumberstrue
collapsetrue
/** */
@Command(name = "add",
    commandDescription = "Add nodes to baseline topology.")
public class BaselineAddCommand implements IgniteCallable<String> {
    /** Auto-injected Ignite instance. */
    @IgniteInstanceResource
    private IgniteEx ignite;

    /** Parameter will be injected on command instantiation. Default comma separation. */
    @Parameter(names = {"--nodes", "-n"}, description = "List of baseline nodes to add.")
    private List<String> consistentIds;

    /** {@inheritDoc} */
    @Override public String call() throws Exception {
        Collection<BaselineNode> baseline = ignite.cluster().currentBaselineTopology();
        Collection<ClusterNode> srvs = ignite.cluster().forServers().nodes();

        for (String consistentId : consistentIds) {
            ClusterNode node = F.find(srvs, null, new IgnitePredicate<ClusterNode>() {
                @Override public boolean apply(ClusterNode node) {
                    return node.consistentId().toString().equals(consistentId);
                }
            });

            if (node == null)
                throw new IllegalArgumentException("Node not found for consistent ID: " + consistentId);

            baseline.add(node);
        }

        ignite.cluster().setBaselineTopology(baseline);

        return consistentIds.toString();
    }
}


Roadmap

Phase-1

The following changes must be introduced to allow new command creation and migration processes:

  • annotations to mark up command classes and annotation-based scanner to fill-up the command registry;
  • command registry (available for clients and for server nodes);
  • input string parsers for CLI, REST, JMX interfaces to allow command migration to a new CommandRegistry;
  • proxy compute task for commands management through the GridTaskExecutor;

Phase-2

To be done.

Risks and Assumptions

// Describe project risks, such as API or binary compatibility issues, major protocol changes, etc.

...