http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1cc3d528/modules/core/src/main/java/org/apache/ignite/streamer/StreamerFailureListener.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerFailureListener.java b/modules/core/src/main/java/org/apache/ignite/streamer/StreamerFailureListener.java deleted file mode 100644 index 8bf23a4..0000000 --- a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerFailureListener.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.streamer; - -import java.util.*; - -/** - * Streamer failure listener. Asynchronous callback passed to user in case of any failure determined by streamer. - * - * @see org.apache.ignite.IgniteStreamer#addStreamerFailureListener(StreamerFailureListener) - * - */ -public interface StreamerFailureListener { - /** - * Callback invoked when unrecoverable failure is detected by streamer. - * <p> - * If {@link StreamerConfiguration#isAtLeastOnce()} is set to {@code false}, then this callback - * will be invoked on node on which failure occurred. If {@link StreamerConfiguration#isAtLeastOnce()} - * is set to {@code true}, then this callback will be invoked on node on which - * {@link org.apache.ignite.IgniteStreamer#addEvents(Collection)} or its variant was called. Callback will be called if maximum - * number of failover attempts exceeded or failover cannot be performed (for example, if router - * returned {@code null}). - * - * @param stageName Failed stage name. - * @param evts Failed set of events. - * @param err Error cause. - */ - public void onFailure(String stageName, Collection<Object> evts, Throwable err); -}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1cc3d528/modules/core/src/main/java/org/apache/ignite/streamer/StreamerMBean.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerMBean.java b/modules/core/src/main/java/org/apache/ignite/streamer/StreamerMBean.java deleted file mode 100644 index 18eaf35..0000000 --- a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerMBean.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * 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.streamer; - -import org.apache.ignite.mxbean.*; -import org.jetbrains.annotations.*; - -/** - * Streamer MBean interface. - */ -@MXBeanDescription("MBean that provides access to streamer description and metrics.") -public interface StreamerMBean { - /** - * Gets streamer name. - * - * @return Streamer name. - */ - @MXBeanDescription("Streamer name.") - @Nullable public String getName(); - - /** - * Gets {@code atLeastOnce} configuration flag. - * - * @return {@code True} if {@code atLeastOnce} is configured. - */ - @MXBeanDescription("True if atLeastOnce is configured.") - public boolean isAtLeastOnce(); - - /** - * Gets size of stage futures map. This map is maintained only when {@code atLeastOnce} configuration - * flag is set to true. - * - * @return Stage future map size. - */ - @MXBeanDescription("Stage future map size.") - public int getStageFutureMapSize(); - - /** - * Gets size of batch futures map. - * - * @return Batch future map size. - */ - @MXBeanDescription("Batch future map size.") - public int getBatchFutureMapSize(); - - /** - * Gets number of stages currently being executed in streamer pool. - * - * @return Number of stages. Cannot be more than pool thread count. - */ - @MXBeanDescription("Number of stages currently being executed in streamer pool.") - public int getStageActiveExecutionCount(); - - /** - * Gets number of event batches currently waiting to be executed. - * - * @return Number of event batches waiting to be processed. - */ - @MXBeanDescription("Number of event batches currently waiting to be executed.") - public int getStageWaitingExecutionCount(); - - /** - * Gets total number of stages executed since last reset. - * - * @return Total number of stages executed since last reset. - */ - @MXBeanDescription("Total number of stages executed since last reset.") - public long getStageTotalExecutionCount(); - - /** - * Gets pipeline maximum execution time, i.e. time between execution start and time when last stage in pipeline - * returned empty map. If pipeline execution was split to different nodes, metrics for each split will be - * recorded independently. - * - * @return Pipeline maximum execution time. - */ - @MXBeanDescription("Pipeline maximum execution time.") - public long getPipelineMaximumExecutionTime(); - - /** - * Gets pipeline minimum execution time, i.e. time between execution start and time when last stage in pipeline - * returned empty map. If pipeline execution was split to different nodes, metrics for each split will be - * recorded independently. - * - * @return Pipeline minimum execution time. - */ - @MXBeanDescription("Pipeline minimum execution time.") - public long getPipelineMinimumExecutionTime(); - - /** - * Gets pipeline average execution time, i.e. time between execution start and time when last stage in pipeline - * returned empty map. If pipeline execution was split, metrics for each split will be recorded independently. - * - * @return Pipeline average execution time. - */ - @MXBeanDescription("Pipeline average execution time.") - public long getPipelineAverageExecutionTime(); - - /** - * Gets maximum number of unique nodes participated in pipeline execution. If pipeline execution was split, - * metrics for each split will be recorded independently. - * - * @return Maximum number of unique nodes in pipeline execution. - */ - @MXBeanDescription("Maximum number of unique nodes participated in pipeline execution.") - public int getPipelineMaximumExecutionNodes(); - - /** - * Gets minimum number of unique nodes participated in pipeline execution. If pipeline execution was split, - * metrics for each split will be recorded independently. - * - * @return Minimum number of unique nodes in pipeline execution. - */ - @MXBeanDescription("Minimum number of unique nodes participated in pipeline execution.") - public int getPipelineMinimumExecutionNodes(); - - /** - * Gets average number of unique nodes participated in pipeline execution. If pipeline execution was split, - * metrics for each split will be recorded independently. - * - * @return Average number of unique nodes in pipeline execution. - */ - @MXBeanDescription("Average number of unique nodes participated in pipeline execution.") - public int getPipelineAverageExecutionNodes(); - - /** - * Gets number of current active sessions. Since event execution sessions are tracked only when - * {@code atLeastOnce} configuration property is set to {@code true}, this metric will be collected - * only in this case. When {@code atLeastOnce} is set to {@code false}, this metric will always be zero. - * - * @return Number of current active sessions. - */ - @MXBeanDescription("Number of current active sessions.") - public int getCurrentActiveSessions(); - - /** - * Gets maximum number of active sessions since last reset. Since event execution sessions are tracked only when - * {@code atLeastOnce} configuration property is set to {@code true}, this metric will be collected - * only in this case. When {@code atLeastOnce} is set to {@code false}, this metric will always be zero. - * - * @return Maximum active sessions since last reset. - */ - @MXBeanDescription("Maximum number of active sessions since last reset.") - public int getMaximumActiveSessions(); - - /** - * Gets number of failures since last reset. If {@code atLeastOnce} flag is set to steamer configuration, - * then only root node failures will be counted. Otherwise each node will count failures independently. - * - * @return Failures count. - */ - @MXBeanDescription("Number of failures since last reset.") - public int getFailuresCount(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1cc3d528/modules/core/src/main/java/org/apache/ignite/streamer/StreamerMetrics.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerMetrics.java b/modules/core/src/main/java/org/apache/ignite/streamer/StreamerMetrics.java deleted file mode 100644 index 5b358f4..0000000 --- a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerMetrics.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * 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.streamer; - -import java.util.*; - -/** - * Streamer metrics. - */ -public interface StreamerMetrics { - /** - * Gets number of stages currently being executed in streamer pool. - * - * @return Number of stages. Cannot be more than pool thread count. - */ - public int stageActiveExecutionCount(); - - /** - * Gets number of event batches currently waiting to be executed. - * - * @return Number of event batches waiting to be processed. - */ - public int stageWaitingExecutionCount(); - - /** - * Gets total number of stages executed since last reset. - * - * @return Total number of stages executed since last reset. - */ - public long stageTotalExecutionCount(); - - /** - * Gets pipeline maximum execution time, i.e. time between execution start and time when last stage in pipeline - * returned empty map. If pipeline execution was split to different nodes, metrics for each split will be - * recorded independently. - * - * @return Pipeline maximum execution time. - */ - public long pipelineMaximumExecutionTime(); - - /** - * Gets pipeline minimum execution time, i.e. time between execution start and time when last stage in pipeline - * returned empty map. If pipeline execution was split to different nodes, metrics for each split will be - * recorded independently. - * - * @return Pipeline minimum execution time. - */ - public long pipelineMinimumExecutionTime(); - - /** - * Gets pipeline average execution time, i.e. time between execution start and time when last stage in pipeline - * returned empty map. If pipeline execution was split, metrics for each split will be recorded independently. - * - * @return Pipeline average execution time. - */ - public long pipelineAverageExecutionTime(); - - /** - * Gets maximum number of unique nodes participated in pipeline execution. If pipeline execution was split, - * metrics for each split will be recorded independently. - * - * @return Maximum number of unique nodes in pipeline execution. - */ - public int pipelineMaximumExecutionNodes(); - - /** - * Gets minimum number of unique nodes participated in pipeline execution. If pipeline execution was split, - * metrics for each split will be recorded independently. - * - * @return Minimum number of unique nodes in pipeline execution. - */ - public int pipelineMinimumExecutionNodes(); - - /** - * Gets average number of unique nodes participated in pipeline execution. If pipeline execution was split, - * metrics for each split will be recorded independently. - * - * @return Average number of unique nodes in pipeline execution. - */ - public int pipelineAverageExecutionNodes(); - - /** - * Gets query maximum execution time. If query execution was split to different nodes, metrics for each split - * will be recorded independently. - * - * @return Query maximum execution time. - */ - public long queryMaximumExecutionTime(); - - /** - * Gets query minimum execution time. If query execution was split to different nodes, metrics for each split - * will be recorded independently. - * - * @return Query minimum execution time. - */ - public long queryMinimumExecutionTime(); - - /** - * Gets query average execution time. If query execution was split to different nodes, metrics for each split - * will be recorded independently. - * - * @return Query average execution time. - */ - public long queryAverageExecutionTime(); - - /** - * Gets maximum number of unique nodes participated in query execution. If query execution was split, - * metrics for each split will be recorded independently. - * - * @return Maximum number of unique nodes in query execution. - */ - public int queryMaximumExecutionNodes(); - - /** - * Gets minimum number of unique nodes participated in query execution. If query execution was split, - * metrics for each split will be recorded independently. - * - * @return Minimum number of unique nodes in query execution. - */ - public int queryMinimumExecutionNodes(); - - /** - * Gets average number of unique nodes participated in query execution. If query execution was split, - * metrics for each split will be recorded independently. - * - * @return Average number of unique nodes in query execution. - */ - public int queryAverageExecutionNodes(); - - /** - * Gets number of current active sessions. Since event execution sessions are tracked only when - * {@code atLeastOnce} configuration property is set to {@code true}, this metric will be collected - * only in this case. When {@code atLeastOnce} is set to {@code false}, this metric will always be zero. - * - * @return Number of current active sessions. - */ - public int currentActiveSessions(); - - /** - * Gets maximum number of active sessions since last reset. Since event execution sessions are tracked only when - * {@code atLeastOnce} configuration property is set to {@code true}, this metric will be collected - * only in this case. When {@code atLeastOnce} is set to {@code false}, this metric will always be zero. - * - * @return Maximum active sessions since last reset. - */ - public int maximumActiveSessions(); - - /** - * Gets number of failures. If {@code atLeastOnce} flag is set to steamer configuration, then only root node - * failures will be counted. Otherwise each node will count failures independently. - * - * @return Failures count. - */ - public int failuresCount(); - - /** - * Gets maximum number of threads in executor service. - * - * @return Maximum number of threads in executor service. - */ - public int executorServiceCapacity(); - - /** - * Gets current stage metrics, if stage with given name is not configured - * then {@link IllegalArgumentException} will be thrown. - * - * @param stageName Stage name. - * @return Stage metrics. - */ - public StreamerStageMetrics stageMetrics(String stageName); - - /** - * Gets metrics for all stages. Stage metrics order is the same as stage order in configuration. - * - * @return Stage metrics collection. - */ - public Collection<StreamerStageMetrics> stageMetrics(); - - /** - * Gets current window metrics, if window with given name is not configured - * then {@link IllegalArgumentException} will be thrown. - * - * @param winName Window name. - * @return Window metrics. - */ - public StreamerWindowMetrics windowMetrics(String winName); - - /** - * Gets metrics for all windows. - * - * @return Collection of window metrics. - */ - public Collection<StreamerWindowMetrics> windowMetrics(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1cc3d528/modules/core/src/main/java/org/apache/ignite/streamer/StreamerStage.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerStage.java b/modules/core/src/main/java/org/apache/ignite/streamer/StreamerStage.java deleted file mode 100644 index 4690be3..0000000 --- a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerStage.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.streamer; - -import org.apache.ignite.*; -import org.jetbrains.annotations.*; - -import java.util.*; - -/** - * Streamer stage is a component that determines event processing flow. User logic related to - * any particular event processing is implemented by streamer stage. A stage takes events as - * an input and returns groups of events mapped to different stages as an output. Events for - * every returned stage will be passed to {@link StreamerEventRouter} which will determine - * on which node the stage should be executed. - * <p> - * Generally, event stage execution graph if fully controlled by return values of - * this method, while node execution graph is controlled by - * {@link StreamerEventRouter#route(StreamerContext, String, Object)} method. - */ -public interface StreamerStage<IN> { - /** - * Gets streamer stage name. - * - * @return Name of the stage. - */ - public String name(); - - /** - * Stage execution routine. After the passed in events are processed, stage can emit - * another set of events to be processed. The returned events can be mapped to different - * stages. Events for every returned stage will be passed to {@link StreamerEventRouter} - * which will determine on which node the stage should be executed. - * <p> - * Generally, event stage execution graph if fully controlled by return values of - * this method, while node execution graph is controlled by - * {@link StreamerEventRouter#route(StreamerContext, String, Object)} method. - * - * @param ctx Streamer context. - * @param evts Input events. - * @return Map of stage name to collection of events. - * @throws IgniteException If failed. - */ - @Nullable public Map<String, Collection<?>> run(StreamerContext ctx, Collection<IN> evts) - throws IgniteException; -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1cc3d528/modules/core/src/main/java/org/apache/ignite/streamer/StreamerStageMBean.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerStageMBean.java b/modules/core/src/main/java/org/apache/ignite/streamer/StreamerStageMBean.java deleted file mode 100644 index 8e46c77..0000000 --- a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerStageMBean.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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.streamer; - -import org.apache.ignite.mxbean.*; - -/** - * Streamer stage MBean. - */ -@MXBeanDescription("MBean that provides access to streamer stage description and metrics.") -public interface StreamerStageMBean { - /** - * Gets stage name. - * - * @return Stage name. - */ - @MXBeanDescription("Stage name.") - public String getName(); - - /** - * Gets stage class name. - * - * @return Stage class name. - */ - @MXBeanDescription("Stage class name.") - public String getStageClassName(); - - /** - * Gets stage minimum execution time. - * - * @return Stage minimum execution time. - */ - @MXBeanDescription("Stage minimum execution time.") - public long getMinimumExecutionTime(); - - /** - * Gets stage maximum execution time. - * - * @return Stage maximum execution time. - */ - @MXBeanDescription("Stage maximum execution time.") - public long getMaximumExecutionTime(); - - /** - * Gets stage average execution time. - * - * @return Stage average execution time. - */ - @MXBeanDescription("Stage average execution time.") - public long getAverageExecutionTime(); - - /** - * Gets stage minimum waiting time. - * - * @return Stage minimum waiting time. - */ - @MXBeanDescription("Stage minimum waiting time.") - public long getMinimumWaitingTime(); - - /** - * Gets stage maximum waiting time. - * - * @return Stage maximum waiting time. - */ - @MXBeanDescription("Stage maximum waiting time.") - public long getMaximumWaitingTime(); - - /** - * Stage average waiting time. - * - * @return Stage average waiting time. - */ - @MXBeanDescription("Stage average waiting time.") - public long getAverageWaitingTime(); - - /** - * Gets total stage execution count since last reset. - * - * @return Number of times this stage was executed. - */ - @MXBeanDescription("Number of times this stage was executed.") - public long getTotalExecutionCount(); - - /** - * Gets stage failure count. - * - * @return Stage failure count. - */ - @MXBeanDescription("Stage failure count.") - public int getFailuresCount(); - - /** - * Gets flag indicating if stage is being currently executed by at least one thread on current node. - * - * @return {@code True} if stage is executing now. - */ - @MXBeanDescription("Whether stage is currently being executed.") - public boolean isExecuting(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1cc3d528/modules/core/src/main/java/org/apache/ignite/streamer/StreamerStageMetrics.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerStageMetrics.java b/modules/core/src/main/java/org/apache/ignite/streamer/StreamerStageMetrics.java deleted file mode 100644 index cde70ec..0000000 --- a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerStageMetrics.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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.streamer; - -/** - * Streamer stage metrics. - */ -public interface StreamerStageMetrics { - /** - * Gets stage name. - * - * @return Stage name. - */ - public String name(); - - /** - * Gets stage minimum execution time. - * - * @return Stage minimum execution time. - */ - public long minimumExecutionTime(); - - /** - * Gets stage maximum execution time. - * - * @return Stage maximum execution time. - */ - public long maximumExecutionTime(); - - /** - * Gets stage average execution time. - * - * @return Stage average execution time. - */ - public long averageExecutionTime(); - - /** - * Gets stage minimum waiting time. - * - * @return Stage minimum waiting time. - */ - public long minimumWaitingTime(); - - /** - * Gets stage maximum waiting time. - * - * @return Stage maximum waiting time. - */ - public long maximumWaitingTime(); - - /** - * Stage average waiting time. - * - * @return Stage average waiting time. - */ - public long averageWaitingTime(); - - /** - * Gets total stage execution count since last reset. - * - * @return Number of times this stage was executed. - */ - public long totalExecutionCount(); - - /** - * Gets stage failure count. - * - * @return Stage failure count. - */ - public int failuresCount(); - - /** - * Gets flag indicating if stage is being currently executed by at least one thread on current node. - * - * @return {@code True} if stage is executing now. - */ - public boolean executing(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1cc3d528/modules/core/src/main/java/org/apache/ignite/streamer/StreamerWindow.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerWindow.java b/modules/core/src/main/java/org/apache/ignite/streamer/StreamerWindow.java deleted file mode 100644 index 730735e..0000000 --- a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerWindow.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * 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.streamer; - -import org.apache.ignite.*; -import org.apache.ignite.streamer.index.*; -import org.jetbrains.annotations.*; - -import java.util.*; - -/** - * Streamer rolling window. Rolling windows allow new event to come in, as well as automatically - * evicting obsolete events on the other side. Windows allow to query into specific time-frame - * or specific sample size of the events. With windows, you can answer questions like "What - * are my top 10 best selling products over last 24 hours?", or "Who are my top 10 users out of - * last 1,000,000 users who logged in?" - * <p> - * Ignite comes with following rolling windows implementations out of the box: - * <ul> - * <li>{@link org.apache.ignite.streamer.window.StreamerUnboundedWindow}</li> - * <li>{@link org.apache.ignite.streamer.window.StreamerBoundedSizeWindow}</li> - * <li>{@link org.apache.ignite.streamer.window.StreamerBoundedSizeBatchWindow}</li> - * <li>{@link org.apache.ignite.streamer.window.StreamerBoundedSizeSortedWindow}</li> - * <li>{@link org.apache.ignite.streamer.window.StreamerBoundedTimeWindow}</li> - * <li>{@link org.apache.ignite.streamer.window.StreamerBoundedTimeBatchWindow}</li> - * </ul> - * <p> - * Streamer window is configured via {@link StreamerConfiguration#getWindows()} method. - */ -public interface StreamerWindow<E> extends Iterable<E> { - /** - * Gets window name. - * - * @return Window name. - */ - public String name(); - - /** - * Gets default index, if default index is not configured then - * {@link IllegalArgumentException} will be thrown. - * - * @param <K> Type of the index key. - * @param <V> Type of the index value. - * @return Index with default name. - */ - public <K, V> StreamerIndex<E, K, V> index(); - - /** - * Gets index by name, if not index with such name was configured then - * {@link IllegalArgumentException} will be thrown. - * - * @param name Name of the index, if {@code null} then analogous to {@link #index()}. - * @param <K> Type of the index key. - * @param <V> Type of the index value. - * @return Index with a given name. - */ - public <K, V> StreamerIndex<E, K, V> index(@Nullable String name); - - /** - * Gets all indexes configured for this window. - * - * @return All indexes configured for this window or empty collection, if no - * indexes were configured. - */ - public Collection<StreamerIndex<E, ?, ?>> indexes(); - - /** - * Resets window. Usually will clear all events from window. - */ - public void reset(); - - /** - * Gets number of events currently stored in window. - * - * @return Current size of the window. - */ - public int size(); - - /** - * Gets number of entries available for eviction. - * - * @return Number of entries available for eviction. - */ - public int evictionQueueSize(); - - /** - * Adds single event to window. - * - * @param evt Event to add. - * @return {@code True} if event was added. - * @throws IgniteException If index update failed. - */ - public boolean enqueue(E evt) throws IgniteException; - - /** - * Adds events to window. - * - * @param evts Events to add. - * @return {@code} - * @throws IgniteException If index update failed. - */ - public boolean enqueue(E... evts) throws IgniteException; - - /** - * Adds all events to window. - * - * @param evts Collection of events to add. - * @return {@code True} if all events were added, {@code false} if at - * least 1 event was skipped. - * @throws IgniteException If index update failed. - */ - public boolean enqueueAll(Collection<E> evts) throws IgniteException; - - /** - * Dequeues last element from windows. Will return {@code null} if window is empty. - * - * @return Dequeued element. - * @throws IgniteException If index update failed. - */ - @Nullable public E dequeue() throws IgniteException; - - /** - * Dequeues up to {@code cnt} elements from window. If current window size is less than {@code cnt}, - * will dequeue all elements from window. - * - * @param cnt Count to dequeue. - * @return Collection of dequeued elements. - * @throws IgniteException If index update failed. - */ - public Collection<E> dequeue(int cnt) throws IgniteException; - - /** - * Dequeues all elements from window. - * - * @return Collection of dequeued elements. - * @throws IgniteException If index update failed. - */ - public Collection<E> dequeueAll() throws IgniteException; - - /** - * If window supports eviction, this method will return next evicted element. - * - * @return Polls and returns next evicted event or {@code null} if eviction queue is empty or if - * window does not support eviction. - * @throws IgniteException If index update failed. - */ - @Nullable public E pollEvicted() throws IgniteException; - - /** - * If window supports eviction, this method will return up to {@code cnt} evicted elements. - * - * @param cnt Number of elements to evict. - * @return Collection of evicted elements. - * @throws IgniteException If index update failed. - */ - public Collection<E> pollEvicted(int cnt) throws IgniteException; - - /** - * If window supports batch eviction, this method will poll next evicted batch from window. - * If windows does not support batch eviction but supports eviction, will return collection of single - * last evicted element. - * If window does not support eviction, will return empty collection. - * - * @return Next evicted batch. - * @throws IgniteException If index update failed. - */ - public Collection<E> pollEvictedBatch() throws IgniteException; - - /** - * If window supports eviction, this method will return all available evicted elements. - * - * @return Collection of evicted elements. - * @throws IgniteException If index update failed. - */ - public Collection<E> pollEvictedAll() throws IgniteException; - - /** - * Clears all evicted entries. - * - * @throws IgniteException If index update failed. - */ - public void clearEvicted() throws IgniteException; - - /** - * Create window snapshot. Evicted entries are not included. - * - * @param includeIvicted Whether to include evicted entries or not. - * @return Window snapshot. - */ - public Collection<E> snapshot(boolean includeIvicted); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1cc3d528/modules/core/src/main/java/org/apache/ignite/streamer/StreamerWindowMBean.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerWindowMBean.java b/modules/core/src/main/java/org/apache/ignite/streamer/StreamerWindowMBean.java deleted file mode 100644 index f0f240d..0000000 --- a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerWindowMBean.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.streamer; - -import org.apache.ignite.mxbean.*; - -/** - * Streamer window MBean. - */ -@MXBeanDescription("MBean that provides access to streamer window description.") -public interface StreamerWindowMBean { - /** - * Gets window name. - * - * @return Window name. - */ - @MXBeanDescription("Window name.") - public String getName(); - - /** - * Gets window class name. - * - * @return Window class name. - */ - @MXBeanDescription("Window class name.") - public String getClassName(); - - /** - * Gets current window size. - * - * @return Current window size. - */ - @MXBeanDescription("Window size.") - public int getSize(); - - /** - * Gets estimate for window eviction queue size. - * - * @return Eviction queue size estimate. - */ - @MXBeanDescription("Eviction queue size estimate.") - public int getEvictionQueueSize(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1cc3d528/modules/core/src/main/java/org/apache/ignite/streamer/StreamerWindowMetrics.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerWindowMetrics.java b/modules/core/src/main/java/org/apache/ignite/streamer/StreamerWindowMetrics.java deleted file mode 100644 index c19f82d..0000000 --- a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerWindowMetrics.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.streamer; - -/** - * Streamer window metrics. - */ -public interface StreamerWindowMetrics { - /** - * Gets window name. - * - * @return Window name. - */ - public String name(); - - /** - * Gets window size. - * - * @return Window size. - */ - public int size(); - - /** - * Gets eviction queue size. - * - * @return Eviction queue size. - */ - public int evictionQueueSize(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1cc3d528/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndex.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndex.java b/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndex.java deleted file mode 100644 index f6a6e9a..0000000 --- a/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndex.java +++ /dev/null @@ -1,305 +0,0 @@ -/* - * 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.streamer.index; - -import org.jetbrains.annotations.*; - -import java.util.*; - -/** - * User view on streamer index. Streamer indexes are used for fast look ups into streamer windows. - * <p> - * Streamer index can be accessed from {@link org.apache.ignite.streamer.StreamerWindow} via any of the following methods: - * <ul> - * <li>{@link org.apache.ignite.streamer.StreamerWindow#index()}</li> - * <li>{@link org.apache.ignite.streamer.StreamerWindow#index(String)}</li> - * <li>{@link org.apache.ignite.streamer.StreamerWindow#indexes()}</li> - * </ul> - * <p> - * Indexes are created and provided for streamer windows by {@link StreamerIndexProvider} which is - * specified in streamer configuration. - * <h1 class="header">Example of how to use indexes</h1> - * <p> - * Stock price events are streamed into the system, the stock price event is an object containing stock symbol and price. - * We need to get minimum price for GOOG instrument. - * <p> - * Here is {@link StreamerIndexUpdater} that maintains index values up to date: - * <pre name="code" class="java"> - * class StockPriceIndexUpdater implements GridStreamerIndexUpdater<StockPriceEvent, String, Double> { - * @Nullable @Override public String indexKey(StockPriceEvent evt) { - * return evt.getSymbol(); // Symbol is an index key. - * } - * - * @Nullable @Override public Double initialValue(StockPriceEvent evt, String key) { - * return evt.getPrice(); // Set first event's price as an initial value. - * } - * - * @Nullable @Override public Double onAdded(GridStreamerIndexEntry<StockPriceEvent, String, Double> entry, - * StockPriceEvent evt) throws IgniteCheckedException { - * return Math.min(entry.value(), evt.getPrice()); // Update the minimum on new event. - * } - * - * @Nullable @Override - * public Double onRemoved(GridStreamerIndexEntry<StockPriceEvent, String, Double> entry, StockPriceEvent evt) { - * return entry.value(); // Leave minimum unchanged when event is evicted. - * } - * } - * </pre> - * <p> - * Here is the code that queries minimum price for GOOG instrument using index: - * <pre name="code" class="java"> - * double minGooglePrice = streamer.context().reduce( - * // This closure will execute on remote nodes. - * new GridClosure<GridStreamerContext, Double>() { - * @Nullable @Override public Double apply(GridStreamerContext ctx) { - * GridStreamerIndex<StockPriceEvent, String, Double> minIdx = ctx.<StockPriceEvent>window().index("min-price"); - * - * return minIdx.entry("GOOG").value(); - * } - * }, - * new GridReducer<Double, Double>() { - * private double minPrice = Integer.MAX_VALUE; - * - * @Override public boolean collect(Double price) { - * minPrice = Math.min(minPrice, price); // Take minimum price from all nodes. - * - * return true; - * } - * - * @Override public Double reduce() { - * return minPrice; - * } - * } - * ); - * </pre> - */ -public interface StreamerIndex<E, K, V> extends Iterable<StreamerIndexEntry<E, K, V>> { - /** - * Index name. - * - * @return Index name. - */ - @Nullable public String name(); - - /** - * Gets index unique flag. If index is unique then exception - * will be thrown if key is already present in the index. - * - * @return Index unique flag. - */ - public boolean unique(); - - /** - * Returns {@code true} if index supports sorting and therefore can perform range operations. - * <p> - * Note that sorting happens by value and not by key. - * - * @return Index sorted flag. - */ - public boolean sorted(); - - /** - * Gets index policy. - * - * @return Index policy. - */ - public StreamerIndexPolicy policy(); - - /** - * @return Number entries in the index. - */ - public int size(); - - /** - * Gets index entry for given key. - * - * @param key Key for which to retrieve entry. - * @return Entry for given key, or {@code null} if one could not be found. - */ - @Nullable public StreamerIndexEntry<E, K, V> entry(K key); - - /** - * Gets read-only collection of entries in the index. - * <p> - * Returned collection is ordered for sorted indexes. - * - * @param cnt If 0 then all entries are returned, - * if positive, then returned collection contains up to {@code cnt} elements - * (in ascending order for sorted indexes), - * if negative, then returned collection contains up to {@code |cnt|} elements - * (in descending order for sorted indexes and not supported for unsorted indexes). - * @return Collection of entries in the index. - */ - public Collection<StreamerIndexEntry<E, K, V>> entries(int cnt); - - /** - * Gets read-only set of index keys. - * <p> - * Returned collection is ordered for sorted indexes. - * - * @param cnt If 0 then all keys are returned, - * if positive, then returned collection contains up to {@code cnt} elements - * (in ascending order for sorted indexes), - * if negative, then returned collection contains up to {@code |cnt|} elements - * (in descending order for sorted indexes and not supported for unsorted indexes). - * @return Read-only set of index keys within given position range. - */ - public Set<K> keySet(int cnt); - - /** - * Gets read-only collection of index values. - * <p> - * Returned collection is ordered for sorted indexes. - * - * @param cnt If 0 then all values are returned, - * if positive, then returned collection contains up to {@code cnt} elements - * (in ascending order for sorted indexes), - * if negative, then returned collection contains up to {@code |cnt|} elements - * (in descending order for sorted indexes and not supported for unsorted indexes). - * @return Read-only collections of index values. - */ - public Collection<V> values(int cnt); - - /** - * Gets read-only collection of index events. - * <p> - * For sorted indexes events are guaranteed to be grouped by corresponding values, however - * the order of the events corresponding to the same value is not defined. - * - * @param cnt If 0 then all values are returned, - * if positive, then returned collection contains up to {@code cnt} elements - * (in ascending order of values for sorted indexes), - * if negative, then returned collection contains up to {@code |cnt|} elements - * (in descending order of values for sorted indexes and not supported for unsorted indexes). - * @return Read-only collections of index events. - * @throws IllegalStateException If index is not configured to track events. - * @see StreamerIndexPolicy - */ - public Collection<E> events(int cnt); - - /** - * Gets read-only set of index entries with given value. - * <p> - * This operation is only available for sorted indexes. - * - * @param val Value. - * @return Read-only set of index entries with given value. - */ - public Set<StreamerIndexEntry<E, K, V>> entrySet(V val); - - /** - * Gets read-only set of index entries within given value range. - * <p> - * This operation is only available for sorted indexes. - * - * @param asc {@code True} for ascending set. - * @param fromVal From value, if {@code null}, then start from beginning. - * @param toVal To value, if {@code null} then include all entries until the end. - * @param fromIncl Whether or not left value is inclusive (ignored if {@code minVal} is {@code null}). - * @param toIncl Whether or not right value is inclusive (ignored if {@code maxVal} is {@code null}). - * @return Read-only set of index entries within given value range. - */ - public Set<StreamerIndexEntry<E, K, V>> entrySet(boolean asc, @Nullable V fromVal, boolean fromIncl, - @Nullable V toVal, boolean toIncl); - - /** - * Gets read-only set of index keys with given value. Iteration order over - * this set has the same order as within index. - * <p> - * This operation is only available for sorted indexes. - * - * @param val Value. - * @return Read-only set of index entries with given value. - */ - public Set<K> keySet(V val); - - /** - * Gets read-only set of index keys within given value range. Iteration order over - * this set has the same order as within index. - * <p> - * This operation is only available for sorted indexes. - * - * @param asc {@code True} for ascending set. - * @param fromVal From value, if {@code null}, then start from beginning. - * @param toVal To value, if {@code null} then include all entries until the end. - * @param fromIncl Whether or not left value is inclusive (ignored if {@code minVal} is {@code null}). - * @param toIncl Whether or not right value is inclusive (ignored if {@code maxVal} is {@code null}). - * @return Read-only set of index entries within given value range. - */ - public Set<K> keySet(boolean asc, @Nullable V fromVal, boolean fromIncl, @Nullable V toVal, boolean toIncl); - - /** - * Gets read-only collection of index values within given value range. Iteration order over - * this collection has the same order as within index. - * <p> - * This operation is only available for sorted indexes. - * - * @param asc {@code True} for ascending set. - * @param fromVal From value, if {@code null}, then start from beginning. - * @param toVal To value, if {@code null} then include all entries until the end. - * @param fromIncl Whether or not left value is inclusive (ignored if {@code minVal} is {@code null}). - * @param toIncl Whether or not right value is inclusive (ignored if {@code maxVal} is {@code null}). - * @return Read-only set of index entries within given value range. - */ - public Collection<V> values(boolean asc, @Nullable V fromVal, boolean fromIncl, @Nullable V toVal, boolean toIncl); - - /** - * Gets read-only collection of index events. - * <p> - * This operation is only available for sorted indexes. - * - * @param val From value, if {@code null}, then start from beginning. - * @return Read-only set of index entries with given value. - */ - public Collection<E> events(@Nullable V val); - - /** - * Gets read-only collection of index events. - * <p> - * Events are guaranteed to be sorted by corresponding values, however - * the order of the events corresponding to the same value is not defined. - * <p> - * This operation is only available for sorted indexes. - * - * @param asc {@code True} for ascending set. - * @param fromVal From value, if {@code null}, then start from beginning. - * @param toVal To value, if {@code null} then include all entries until the end. - * @param fromIncl Whether or not left value is inclusive (ignored if {@code minVal} is {@code null}). - * @param toIncl Whether or not right value is inclusive (ignored if {@code maxVal} is {@code null}). - * @return Read-only set of index entries within given value range. - */ - public Collection<E> events(boolean asc, @Nullable V fromVal, boolean fromIncl, @Nullable V toVal, boolean toIncl); - - /** - * Gets first entry in the index. - * <p> - * This operation is only available for sorted indexes. - * - * @return First entry in the index, or {@code null} if index is empty. - */ - @Nullable public StreamerIndexEntry<E, K, V> firstEntry(); - - /** - * Gets last entry in the index. - * <p> - * This operation is only available for sorted indexes. - * - * @return Last entry in the index, or {@code null} if index is empty. - */ - @Nullable public StreamerIndexEntry<E, K, V> lastEntry(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1cc3d528/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexEntry.java b/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexEntry.java deleted file mode 100644 index 502443d..0000000 --- a/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexEntry.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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.streamer.index; - - -import org.jetbrains.annotations.*; - -import java.util.*; - -/** - * Streamer index entry. Individual index entry contains index key, value, and all events - * associated with given key. - * - */ -public interface StreamerIndexEntry<E, K, V> { - /** - * Gets events associated with given index key and value. - * <p> - * Events are tracked only if {@link StreamerIndexProvider#getPolicy()} - * is set to {@link StreamerIndexPolicy#EVENT_TRACKING_ON} or - * {@link StreamerIndexPolicy#EVENT_TRACKING_ON_DEDUP}. - * - * @return Events associated with given index key and value or {@code null} if event tracking is off. - */ - @Nullable public Collection<E> events(); - - /** - * Gets index entry key. - * - * @return Index entry key. - */ - public K key(); - - /** - * Gets index entry value. - * <p> - * For sorted indexes, the sorting happens based on this value. - * - * @return Index entry value. - */ - public V value(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1cc3d528/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexPolicy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexPolicy.java b/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexPolicy.java deleted file mode 100644 index 0e3e922..0000000 --- a/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexPolicy.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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.streamer.index; - -/** - * Streamer index policy, which defines how events - * are tracked within an index. - */ -public enum StreamerIndexPolicy { - /** - * Do not track events. - * <p> - * Only a value, generated by {@link StreamerIndexUpdater}, - * will be stored in an index; event objects will be thrown away. - */ - EVENT_TRACKING_OFF, - - /** - * Track events. - * <p> - * All event objects will stored in an index along with the values, - * generated by {@link StreamerIndexUpdater}. - */ - EVENT_TRACKING_ON, - - /** - * Track events with de-duplication. - * <p> - * All event objects will stored in an index along with the values, - * generated by {@link StreamerIndexUpdater}. For duplicate (equal) - * events, only a single event object will be stored, which corresponds - * to a first event. - */ - EVENT_TRACKING_ON_DEDUP -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1cc3d528/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexProvider.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexProvider.java b/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexProvider.java deleted file mode 100644 index e510985..0000000 --- a/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexProvider.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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.streamer.index; - -import org.apache.ignite.*; - -/** - * Represents an actual instance of an index. Used by a {@link org.apache.ignite.streamer.StreamerWindow} - * to perform event indexing. - * <p> - * To configure index for a streamer window, use - * {@link org.apache.ignite.streamer.window.StreamerWindowAdapter#setIndexes(StreamerIndexProvider[])}. - */ -public interface StreamerIndexProvider<E, K, V> extends StreamerIndexProviderMBean { - /** - * Gets index name. - * - * @return Name of the index. - */ - public String getName(); - - /** - * Gets user view for this index. This view is a snapshot - * of a current index state. Once returned, it does not - * change over time. - * - * @return User view for this index. - */ - public StreamerIndex<E, K, V> index(); - - /** - * Initializes the index. - */ - public void initialize(); - - /** - * Resets the index to an initial empty state. - */ - public void reset(); - - /** - * Disposes the index. - */ - public void dispose(); - - /** - * Adds an event to index. - * - * @param sync Index update synchronizer. - * @param evt Event to add to an index. - * @throws IgniteException If failed to add event to an index. - */ - public void add(StreamerIndexUpdateSync sync, E evt) throws IgniteException; - - /** - * Removes an event from index. - * - * @param sync Index update synchronizer. - * @param evt Event to remove from index. - * @throws IgniteException If failed to add event to an index. - */ - public void remove(StreamerIndexUpdateSync sync, E evt) throws IgniteException; - - /** - * Gets event indexing policy, which defines how events - * are tracked within an index. - * - * @return index policy. - */ - public StreamerIndexPolicy getPolicy(); - - /** - * Checks whether this index is unique or not. If it is, equal events - * are not allowed, which means that if a newly-added event is found - * to be equal to one of the already present events - * ({@link Object#equals(Object)} returns {@code true}), an exception - * is thrown. - * - * @return {@code True} for unique index. - */ - public boolean isUnique(); - - /** - * Finalizes an update operation. - * - * @param sync Index update synchronizer. - * @param evt Updated event. - * @param rollback Rollback flag. If {@code true}, a rollback was made. - * @param rmv Remove flag. If {@code true}, the event was removed from index. - */ - public void endUpdate(StreamerIndexUpdateSync sync, E evt, boolean rollback, boolean rmv); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1cc3d528/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexProviderAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexProviderAdapter.java b/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexProviderAdapter.java deleted file mode 100644 index 51f34ee..0000000 --- a/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexProviderAdapter.java +++ /dev/null @@ -1,796 +0,0 @@ -/* - * 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.streamer.index; - -import com.romix.scala.*; -import com.romix.scala.collection.concurrent.*; -import org.apache.ignite.*; -import org.apache.ignite.internal.util.*; -import org.apache.ignite.internal.util.typedef.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.lang.*; -import org.jdk8.backport.*; -import org.jetbrains.annotations.*; -import org.pcollections.*; - -import java.util.*; -import java.util.concurrent.*; - -import static org.apache.ignite.streamer.index.StreamerIndexPolicy.*; - -/** - * Convenient {@link StreamerIndexProvider} adapter implementing base configuration methods. - */ -public abstract class StreamerIndexProviderAdapter<E, K, V> implements StreamerIndexProvider<E, K, V> { - /** */ - protected final IgniteClosure<StreamerIndexEntry<E, K, V>, V> entryToVal = - new C1<StreamerIndexEntry<E, K, V>, V>() { - @Override public V apply(StreamerIndexEntry<E, K, V> e) { - return e.value(); - } - }; - - /** */ - protected final IgniteClosure<StreamerIndexEntry<E, K, V>, K> entryToKey = - new C1<StreamerIndexEntry<E, K, V>, K>() { - @Override public K apply(StreamerIndexEntry<E, K, V> e) { - return e.key(); - } - }; - - /** Keys currently being updated. */ - private final ConcurrentMap<K, StreamerIndexUpdateSync> locks = new ConcurrentHashMap8<>(); - - /** Index name. */ - private String name; - - /** Index policy. */ - private StreamerIndexPolicy plc = EVENT_TRACKING_OFF; - - /** Index updater. */ - private StreamerIndexUpdater<E, K, V> updater; - - /** */ - private final LongAdder evtsCnt = new LongAdder(); - - /** Read write lock. */ - private final GridSpinReadWriteLock rwLock = new GridSpinReadWriteLock(); - - /** */ - private boolean unique; - - /** */ - private final ThreadLocal<K> threadLocKey = new ThreadLocal<>(); - - /** */ - private final ConcurrentMap<IndexKey<V>, StreamerIndexUpdateSync> idxLocks = new ConcurrentHashMap8<>(); - - /** */ - private boolean keyCheck = true; - - /** - * Sets index name. - * - * @param name Index name. - */ - public void setName(String name) { - this.name = name; - } - - /** {@inheritDoc} */ - @Override public String getName() { - return name; - } - - /** - * Sets index policy. - * - * @param plc Policy. - */ - public void setPolicy(StreamerIndexPolicy plc) { - this.plc = plc; - } - - /** {@inheritDoc} */ - @Override public StreamerIndexPolicy getPolicy() { - return plc; - } - - /** - * Sets unique flag. - * - * @param unique {@code True} for unique index. - */ - public void setUnique(boolean unique) { - this.unique = unique; - } - - /** {@inheritDoc} */ - @Override public boolean isUnique() { - return unique; - } - - /** - * Sets index updater. - * - * @param updater Updater. - */ - public void setUpdater(StreamerIndexUpdater<E, K, V> updater) { - this.updater = updater; - } - - /** - * Gets index updater. - * - * @return Updater. - */ - public StreamerIndexUpdater<E, K, V> getUpdater() { - return updater; - } - - /** {@inheritDoc} */ - @Override public void dispose() { - // No-op. - } - - /** - * Add event to the index. - * - * @param sync Sync. - * @param evt Event. - */ - @Override public void add(StreamerIndexUpdateSync sync, E evt) { - assert evt != null; - - if (threadLocKey.get() != null) - throw new IllegalStateException("Previous operation has not been finished: " + threadLocKey.get()); - - K key = updater.indexKey(evt); - - if (key == null) - return; // Ignore event. - - validateIndexKey(key); - - readLock(); - - threadLocKey.set(key); - - lockKey(key, sync); - - add(evt, key, sync); - } - - /** - * Remove event from the index. - * - * @param sync Sync. - * @param evt Event. - */ - @Override public void remove(StreamerIndexUpdateSync sync, E evt) { - assert evt != null; - - if (threadLocKey.get() != null) - throw new IllegalStateException("Previous operation has not been finished: " + threadLocKey.get()); - - K key = updater.indexKey(evt); - - assert key != null; - - validateIndexKey(key); - - readLock(); - - threadLocKey.set(key); - - lockKey(key, sync); - - remove(evt, key, sync); - } - - /** {@inheritDoc} */ - @Override public void endUpdate(StreamerIndexUpdateSync sync, E evt, boolean rollback, boolean rmv) { - K key = threadLocKey.get(); - - if (key == null) - return; - - if (!rollback) { - if (rmv) - evtsCnt.decrement(); - else - evtsCnt.increment(); - } - - threadLocKey.remove(); - - endUpdate0(sync, evt, key, rollback); - - unlockKey(key, sync); - - readUnlock(); - } - - /** - * @param sync Sync. - * @param evt Event. - * @param key Key. - * @param rollback Rollback flag. - */ - protected abstract void endUpdate0(StreamerIndexUpdateSync sync, E evt, K key, boolean rollback); - - /** {@inheritDoc} */ - @Override public void reset() { - writeLock(); - - try { - reset0(); - } - finally { - writeUnlock(); - } - } - - /** {@inheritDoc} */ - @Override public StreamerIndex<E, K, V> index() { - writeLock(); - - try { - return index0(); - } - finally { - writeUnlock(); - } - } - - /** - * Called on reset. - */ - protected abstract void reset0(); - - /** - * @return Index - */ - protected abstract StreamerIndex<E, K, V> index0(); - - /** - * - */ - protected void readLock() { - rwLock.readLock(); - } - - /** - * - */ - protected void readUnlock() { - rwLock.readUnlock(); - } - - /** - * - */ - protected void writeLock() { - rwLock.writeLock(); - } - - /** - * - */ - protected void writeUnlock() { - rwLock.writeUnlock(); - } - - /** - * @return Events count, - */ - protected int eventsCount() { - return evtsCnt.intValue(); - } - - /** - * Add event to the index. - * - * @param evt Event. - * @param key key. - * @param sync Sync. - * @throws IgniteException If failed. - */ - protected abstract void add(E evt, K key, StreamerIndexUpdateSync sync) throws IgniteException; - - /** - * Remove event from the index. - * - * @param evt Event. - * @param key Key. - * @param sync Sync. - * @throws IgniteException If failed. - */ - protected abstract void remove(E evt, K key, StreamerIndexUpdateSync sync) throws IgniteException; - - /** - * Lock updates on particular key. - * - * @param key Key. - * @param sync Sync. - * @throws IgniteException If failed. - */ - private void lockKey(K key, StreamerIndexUpdateSync sync) throws IgniteException { - assert key != null; - assert sync != null; - - while (true) { - StreamerIndexUpdateSync old = locks.putIfAbsent(key, sync); - - if (old != null) { - try { - old.await(); - } - catch (InterruptedException e) { - throw new IgniteException("Failed to lock on key (thread has been interrupted): " + key, e); - } - - // No point to replace or remove sync here. - // Owner will first remove it, then will finish the sync. - } - else - break; - } - } - - /** - * Unlock updates on particular key. - * - * @param key Key. - * @param sync Sync. - */ - private void unlockKey(K key, StreamerIndexUpdateSync sync) { - assert key != null; - - locks.remove(key, sync); - } - - /** - * Lock updates on particular key. - * - * @param key Key. - * @param sync Sync. - * @throws IgniteException If failed. - */ - protected void lockIndexKey(IndexKey<V> key, StreamerIndexUpdateSync sync) throws IgniteException { - assert key != null; - assert sync != null; - assert isUnique(); - - while (true) { - StreamerIndexUpdateSync old = idxLocks.putIfAbsent(key, sync); - - if (old != null) { - try { - old.await(); - } - catch (InterruptedException e) { - throw new IgniteException("Failed to lock on key (thread has been interrupted): " + key, e); - } - - // No point to replace or remove sync here. - // Owner will first remove it, then will finish the sync. - } - else - break; - } - } - - /** - * Unlock updates on particular key. - * - * @param key Key. - * @param sync Sync. - */ - protected void unlockIndexKey(IndexKey<V> key, StreamerIndexUpdateSync sync) { - assert key != null; - assert isUnique(); - - idxLocks.remove(key, sync); - } - - /** - * @param key Key, - * @param val Value. - * @param idxKey Index key. - * @param evt Event. - * @return Entry. - */ - protected Entry<E, K, V> newEntry(K key, V val, @Nullable IndexKey<V> idxKey, E evt) { - StreamerIndexPolicy plc = getPolicy(); - - switch (plc) { - case EVENT_TRACKING_OFF: - return new NonTrackingEntry<>(key, val, idxKey); - - case EVENT_TRACKING_ON: - return new EventTrackingEntry<>(addToCollection(null, evt), key, val, idxKey); - - default: - assert plc == EVENT_TRACKING_ON_DEDUP : "Unknown policy: " + plc; - - return new DedupTrackingEntry<>(addToMap(null, evt), key, val, idxKey); - } - } - - /** - * @param oldEntry Old entry. - * @param key Key, - * @param val Value. - * @param idxKey Index key. - * @param evt Event. - * @return Entry. - */ - protected Entry<E, K, V> addEvent(StreamerIndexEntry<E,K,V> oldEntry, K key, V val, - @Nullable IndexKey<V> idxKey, E evt) { - StreamerIndexPolicy plc = getPolicy(); - - switch (plc) { - case EVENT_TRACKING_OFF: - return new NonTrackingEntry<>(key, val, idxKey); - - case EVENT_TRACKING_ON: - return new EventTrackingEntry<>(addToCollection(oldEntry.events(), evt), key, val, idxKey); - - default: - assert plc == EVENT_TRACKING_ON_DEDUP : "Unknown policy: " + plc; - - return new DedupTrackingEntry<>(addToMap(((DedupTrackingEntry<E, K, V>)oldEntry).rawEvents(), evt), - key, val, idxKey); - } - } - - /** - * @param oldEntry Old entry. - * @param key Key, - * @param val Value. - * @param idxKey Index key. - * @param evt Event. - * @return Entry. - */ - protected Entry<E, K, V> removeEvent(StreamerIndexEntry<E, K, V> oldEntry, K key, V val, - @Nullable IndexKey<V> idxKey, E evt) { - StreamerIndexPolicy plc = getPolicy(); - - switch (plc) { - case EVENT_TRACKING_OFF: - return new NonTrackingEntry<>(key, val, idxKey); - - case EVENT_TRACKING_ON: - Collection<E> oldEvts = oldEntry.events(); - - assert oldEvts != null; // Event tracking is on. - - Collection<E> newEvts = removeFromCollection(oldEvts, evt); - - return new EventTrackingEntry<>(newEvts != null ? newEvts : oldEvts, key, val, idxKey); - - default: - assert plc == EVENT_TRACKING_ON_DEDUP : "Unknown policy: " + plc; - - Map<E, Integer> oldMap = ((DedupTrackingEntry<E, K, V>)oldEntry).rawEvents(); - - assert oldMap != null; // Event tracking is on. - - Map<E, Integer> newMap = removeFromMap(oldMap, evt); - - return new DedupTrackingEntry<>(newMap != null ? newMap : oldMap, key, val, idxKey); - } - } - - /** - * @param col Collection. - * @param evt Event. - * @return Cloned collection. - */ - protected static <E> Collection<E> addToCollection(@Nullable Collection<E> col, E evt) { - PVector<E> res = col == null ? TreePVector.<E>empty() : (PVector<E>)col; - - return res.plus(evt); - } - - /** - * @param map Collection. - * @param evt Event. - * @return Cloned map. - */ - protected static <E> Map<E, Integer> addToMap(@Nullable Map<E, Integer> map, E evt) { - HashPMap<E, Integer> res = map == null ? HashTreePMap.<E, Integer>empty() : (HashPMap<E, Integer>)map; - - Integer cnt = res.get(evt); - - return cnt != null ? res.minus(evt).plus(evt, cnt + 1) : res.plus(evt, 1); - } - - /** - * @param col Collection. - * @param evt Event. - * @return Cloned collection. - */ - @Nullable protected static <E> Collection<E> removeFromCollection(@Nullable Collection<E> col, E evt) { - if (col == null) - return null; - - PVector<E> res = (PVector<E>)col; - - res = res.minus(evt); - - return res.isEmpty() ? null : res; - } - - /** - * @param map Collection. - * @param evt Event. - * @return Cloned map. - */ - @Nullable protected static <E> Map<E, Integer> removeFromMap(@Nullable Map<E, Integer> map, E evt) { - if (map == null) - return null; - - HashPMap<E, Integer> res = (HashPMap<E, Integer>)map; - - Integer cnt = res.get(evt); - - return cnt == null ? res : cnt == 1 ? res.minus(evt) : res.minus(evt).plus(evt, cnt - 1); - } - - /** {@inheritDoc} */ - @Override public String name() { - return name; - } - - /** {@inheritDoc} */ - @Override public String updaterClass() { - return updater.getClass().getName(); - } - - /** {@inheritDoc} */ - @Override public boolean unique() { - return unique; - } - - /** {@inheritDoc} */ - @Override public StreamerIndexPolicy policy() { - return plc; - } - - /** {@inheritDoc} */ - @Override public int size() { - return index0().size(); - } - - /** - * Validates that given index key has overridden equals and hashCode methods. - * - * @param key Index key. - * @throws IllegalArgumentException If validation fails. - */ - private void validateIndexKey(@Nullable Object key) { - if (keyCheck) { - keyCheck = false; - - if (key == null) - return; - - if (!U.overridesEqualsAndHashCode(key)) - throw new IllegalArgumentException("Index key must override hashCode() and equals() methods: " + - key.getClass().getName()); - } - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(StreamerIndexProviderAdapter.class, this); - } - - /** - * Streamer window index key. - */ - protected interface IndexKey<V> { - /** - * @return Value associated with this key. - */ - public V value(); - } - - /** - * Utility method to safely get values from TrieMap. - * See: https://github.com/romix/java-concurrent-hash-trie-map/issues/4 - * - * @param key Key. - * @param map Trie map. - * @return Value from map. - */ - @SuppressWarnings({"IfMayBeConditional", "TypeMayBeWeakened"}) - protected static <K, V> V trieGet(K key, TrieMap<K, V> map) { - Object r = map.get(key); - - if(r instanceof Some) - return ((Some<V>)r).get (); - else if(r instanceof None) - return null; - else - return (V)r; - } - - /** - * Streamer window index entry. - */ - protected abstract static class Entry<E, K, V> implements StreamerIndexEntry<E, K, V> { - /** */ - private final K key; - - /** */ - private final V val; - - /** */ - private final IndexKey<V> idxKey; - - /** - * @param key Key. - * @param val Value. - * @param idxKey Key index. - */ - Entry(K key, V val, @Nullable IndexKey<V> idxKey) { - assert key != null; - assert val != null; - assert idxKey == null || idxKey.value() == val : "Keys are invalid [idxKey=" + idxKey + ", val=" + val +']'; - - this.key = key; - this.val = val; - this.idxKey = idxKey; - } - - /** {@inheritDoc} */ - @Override public K key() { - return key; - } - - /** {@inheritDoc} */ - @Override public V value() { - return val; - } - - /** - * @return Internal key. - */ - @Nullable public IndexKey<V> keyIndex() { - return idxKey; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object obj) { - if (!(obj instanceof Entry)) - return false; - - StreamerIndexEntry<E, K, V> e = (StreamerIndexEntry<E, K, V>)obj; - - return key.equals(e.key()); - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - return key.hashCode(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(Entry.class, this, "identity", System.identityHashCode(this)); - } - } - - /** - * Entry with index policy {@link StreamerIndexPolicy#EVENT_TRACKING_OFF}. - */ - protected static class NonTrackingEntry<E, K, V> extends Entry<E, K, V> { - /** - * @param key Key. - * @param val Value. - * @param idxKey Key index. - */ - public NonTrackingEntry(K key, V val, @Nullable IndexKey<V> idxKey) { - super(key, val, idxKey); - } - - /** {@inheritDoc} */ - @Override public Collection<E> events() { - return null; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(NonTrackingEntry.class, this, super.toString()); - } - } - - /** - * Entry with index policy {@link StreamerIndexPolicy#EVENT_TRACKING_ON}. - */ - protected static class EventTrackingEntry<E, K, V> extends Entry<E, K, V> { - /** */ - private final Collection<E> evts; - - /** - * @param evts Events. - * @param key Key. - * @param val Value. - * @param idxKey Key index. - */ - public EventTrackingEntry(Collection<E> evts, K key, V val, @Nullable IndexKey<V> idxKey) { - super(key, val, idxKey); - - assert evts == null || !evts.isEmpty() : "Invalid events: " + evts; - - this.evts = evts; - } - - /** {@inheritDoc} */ - @Override public Collection<E> events() { - return evts; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(EventTrackingEntry.class, this, "evtCnt", evts.size(), "parent", super.toString()); - } - } - - /** - * Entry with index policy {@link StreamerIndexPolicy#EVENT_TRACKING_ON_DEDUP}. - */ - protected static class DedupTrackingEntry<E, K, V> extends Entry<E, K, V> { - /** */ - private final Map<E, Integer> evts; - - /** - * @param evts Events. - * @param key Key. - * @param val Value. - * @param idxKey Key index. - */ - public DedupTrackingEntry(Map<E, Integer> evts, K key, V val, @Nullable IndexKey<V> idxKey) { - super(key, val, idxKey); - - assert evts == null || !evts.isEmpty() : "Invalid events: " + evts; - - this.evts = evts; - } - - /** {@inheritDoc} */ - @Override public Collection<E> events() { - return Collections.unmodifiableSet(evts.keySet()); - } - - /** - * @return Events. - */ - @Nullable public Map<E, Integer> rawEvents() { - return evts; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(DedupTrackingEntry.class, this, "evtCnt", evts.size(), "parent", super.toString()); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1cc3d528/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexProviderMBean.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexProviderMBean.java b/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexProviderMBean.java deleted file mode 100644 index a256985..0000000 --- a/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexProviderMBean.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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.streamer.index; - -import org.apache.ignite.mxbean.*; -import org.jetbrains.annotations.*; - -/** - * Streamer window index provider MBean. - */ -public interface StreamerIndexProviderMBean { - /** - * Index name. - * - * @return Index name. - */ - @MXBeanDescription("Index name.") - @Nullable public String name(); - - /** - * Gets index updater class name. - * - * @return Index updater class. - */ - @MXBeanDescription("Index updater class name.") - public String updaterClass(); - - /** - * Gets index unique flag. - * - * @return Index unique flag. - */ - @MXBeanDescription("Index unique flag.") - public boolean unique(); - - /** - * Returns {@code true} if index supports sorting and therefore can perform range operations. - * - * @return Index sorted flag. - */ - @MXBeanDescription("Index sorted flag.") - public boolean sorted(); - - /** - * Gets index policy. - * - * @return Index policy. - */ - @MXBeanDescription("Index policy.") - public StreamerIndexPolicy policy(); - - /** - * Gets current index size. - * - * @return Current index size. - */ - @MXBeanDescription("Current index size.") - public int size(); -}