Versions Compared

Key

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

...

draw.io Diagram
bordertrue
diagramNameCommand Registry
simpleViewerfalse
width
linksauto
tbstyletop
lboxtrue
diagramWidth1433
revision1

Command

Management commands are always wrapped with the ProxyManagementTask. The management command may be executed on a single cluster node only or broadcasted to all nodes with reducing the execution results.


Code Block
languagejava
titleIgniteCommand
linenumberstrue
collapsetrue
/** */
public interface IgniteCommand<T> extends IgniteCallable<T>, IgniteReducer<T, T> {
    /** {@inheritDoc} */
    @Override public default boolean collect(@Nullable T t) {
        return true;
    }

    /** {@inheritDoc} */
    @Override public default T reduce() {
        return null;
    }
}


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


Phase-2


Risks and Assumptions

...