-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ignite-5852 : Introduced BaselineTopology mechanics.
- Loading branch information
Showing
28 changed files
with
1,930 additions
and
967 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
modules/core/src/main/java/org/apache/ignite/internal/cluster/DetachedClusterNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.apache.ignite.internal.cluster; | ||
|
||
import java.util.Collection; | ||
import java.util.Map; | ||
import java.util.UUID; | ||
import org.apache.ignite.cluster.ClusterMetrics; | ||
import org.apache.ignite.cluster.ClusterNode; | ||
import org.apache.ignite.lang.IgniteProductVersion; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
/** | ||
* Representation of cluster node that isn't currently present in cluster. | ||
*/ | ||
public class DetachedClusterNode implements ClusterNode { | ||
/** Consistent ID. */ | ||
private final Object consistentId; | ||
|
||
/** Node attributes. */ | ||
private final Map<String, Object> attributes; | ||
|
||
/** | ||
* @param consistentId Consistent ID. | ||
* @param attributes Node attributes. | ||
*/ | ||
public DetachedClusterNode(Object consistentId, Map<String, Object> attributes) { | ||
this.consistentId = consistentId; | ||
this.attributes = attributes; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override public UUID id() { | ||
throw new UnsupportedOperationException("Not implemented"); | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override public Object consistentId() { | ||
return consistentId; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Nullable @Override public <T> T attribute(String name) { | ||
return (T)attributes.get(name); | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override public ClusterMetrics metrics() { | ||
throw new UnsupportedOperationException("Not implemented"); | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override public Map<String, Object> attributes() { | ||
return attributes; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override public Collection<String> addresses() { | ||
throw new UnsupportedOperationException("Not implemented"); | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override public Collection<String> hostNames() { | ||
throw new UnsupportedOperationException("Not implemented"); | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override public long order() { | ||
throw new UnsupportedOperationException("Not implemented"); | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override public IgniteProductVersion version() { | ||
throw new UnsupportedOperationException("Not implemented"); | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override public boolean isLocal() { | ||
return false; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override public boolean isDaemon() { | ||
return false; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override public boolean isClient() { | ||
return false; | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
modules/core/src/main/java/org/apache/ignite/internal/cluster/NodeOrderComparator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.apache.ignite.internal.cluster; | ||
|
||
import java.io.Serializable; | ||
import java.util.Comparator; | ||
import org.apache.ignite.IgniteSystemProperties; | ||
import org.apache.ignite.cluster.ClusterNode; | ||
|
||
/** | ||
* Node order comparator. | ||
*/ | ||
public class NodeOrderComparator implements Comparator<ClusterNode>, Serializable { | ||
/** */ | ||
private static final long serialVersionUID = 0L; | ||
|
||
/** */ | ||
private static final Comparator<ClusterNode> INSTANCE = new NodeOrderComparator(); | ||
|
||
public static final Comparator<ClusterNode> getInstance() { | ||
return IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_USE_LEGACY_NODE_COMPARATOR) ? | ||
NodeOrderLegacyComparator.INSTANCE : INSTANCE; | ||
} | ||
|
||
/** | ||
* Private constructor. Don't create this class, use {@link #getInstance()}. | ||
*/ | ||
private NodeOrderComparator() { | ||
|
||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override public int compare(ClusterNode n1, ClusterNode n2) { | ||
Object consId1 = n1.consistentId(); | ||
Object consId2 = n2.consistentId(); | ||
|
||
if (consId1 instanceof Comparable && consId2 instanceof Comparable) { | ||
return ((Comparable)consId1).compareTo(consId2); | ||
} | ||
|
||
return consId1.toString().compareTo(consId2.toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.