You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2017/03/14 12:09:16 UTC
ignite git commit: Added index state notion. Need to wire it up with
other disco messages.
Repository: ignite
Updated Branches:
refs/heads/ignite-4565-ddl ccd098b09 -> 98e118778
Added index state notion. Need to wire it up with other disco messages.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/98e11877
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/98e11877
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/98e11877
Branch: refs/heads/ignite-4565-ddl
Commit: 98e118778e0a6908c26d5f3dd01eba85544169d9
Parents: ccd098b
Author: devozerov <vo...@gridgain.com>
Authored: Tue Mar 14 15:09:07 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Tue Mar 14 15:09:07 2017 +0300
----------------------------------------------------------------------
.../cache/DynamicCacheChangeRequest.java | 28 +++++++
.../processors/query/QueryIndexState.java | 77 ++++++++++++++++++++
2 files changed, 105 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/98e11877/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
index b446492..aaab4e2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
@@ -18,10 +18,14 @@
package org.apache.ignite.internal.processors.cache;
import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
import java.util.UUID;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.query.QueryIndexState;
import org.apache.ignite.internal.processors.query.ddl.AbstractIndexOperation;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -75,6 +79,9 @@ public class DynamicCacheChangeRequest implements Serializable {
/** Index operation in init phase. */
private AbstractIndexOperation idxInitOp;
+ /** Dynamic index states. */
+ private Map<String, QueryIndexState> idxStates;
+
/** */
private transient boolean exchangeNeeded;
@@ -302,6 +309,27 @@ public class DynamicCacheChangeRequest implements Serializable {
this.idxInitOp = idxInitOp;
}
+ /**
+ * @return Dynamic index states.
+ */
+ public Map<String, QueryIndexState> indexStates() {
+ return idxStates == null ? Collections.<String, QueryIndexState>emptyMap() : idxStates;
+ }
+
+ /**
+ * Add dynamic index state.
+ *
+ * @param idxState Index state.
+ */
+ public void addIndexState(QueryIndexState idxState) {
+ if (idxStates == null)
+ idxStates = new HashMap<>();
+
+ String name = idxState.indexName();
+
+ idxStates.put(name, idxState);
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(DynamicCacheChangeRequest.class, this, "cacheName", cacheName());
http://git-wip-us.apache.org/repos/asf/ignite/blob/98e11877/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryIndexState.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryIndexState.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryIndexState.java
new file mode 100644
index 0000000..1af7ff6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryIndexState.java
@@ -0,0 +1,77 @@
+/*
+ * 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.processors.query;
+
+import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.Serializable;
+
+/**
+ * Dynamic index state
+ */
+public class QueryIndexState implements Serializable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Index name. */
+ private final String idxName;
+
+ /** Index. */
+ @GridToStringInclude
+ private final QueryIndex idx;
+
+ /**
+ * Constructor.
+ *
+ * @param idxName Index name.
+ * @param idx Index descriptor.
+ */
+ public QueryIndexState(String idxName, @Nullable QueryIndex idx) {
+ this.idxName = idxName;
+ this.idx = idx;
+ }
+
+ /**
+ * @return Index name.
+ */
+ public String indexName() {
+ return idxName;
+ }
+
+ /**
+ * @return Index.
+ */
+ @Nullable public QueryIndex index() {
+ return idx;
+ }
+
+ /**
+ * @return {@code True} if index is removed.
+ */
+ public boolean removed() {
+ return idx == null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(QueryIndexState.class, this);
+ }
+}