You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by li...@apache.org on 2019/11/08 05:07:50 UTC

[incubator-iotdb] 01/01: feat(ActiveTimeSeriesCounter): add ActiveTimeSeriesCounter interface

This is an automated email from the ASF dual-hosted git repository.

liurui pushed a commit to branch dynamic_config
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git

commit 9d417b43caf78735144f833537b3fa53d42f294b
Author: liuruiyiyang <24...@qq.com>
AuthorDate: Fri Nov 8 13:07:23 2019 +0800

    feat(ActiveTimeSeriesCounter): add ActiveTimeSeriesCounter interface
---
 pom.xml                                            |  6 +++
 .../db/conf/adapter/ActiveTimeSeriesCounter.java   | 34 ++++++++++++++++
 .../db/conf/adapter/IActiveTimeSeriesCounter.java  | 45 ++++++++++++++++++++++
 3 files changed, 85 insertions(+)

diff --git a/pom.xml b/pom.xml
index 5b8804e..74802d0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,6 +76,7 @@
         <commons.collections4>4.0</commons.collections4>
         <thrift.version>0.9.3</thrift.version>
         <airline.version>0.8</airline.version>
+        <streamlib.version>2.9.5</streamlib.version>
         <jackson.version>2.10.0</jackson.version>
         <antlr3.version>3.5.2</antlr3.version>
         <common.cli.version>1.3.1</common.cli.version>
@@ -416,6 +417,11 @@
                 <artifactId>airline</artifactId>
                 <version>${airline.version}</version>
             </dependency>
+            <dependency>
+                <groupId>com.clearspring.analytics</groupId>
+                <artifactId>stream</artifactId>
+                <version>${streamlib.version}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
     <dependencies>
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/adapter/ActiveTimeSeriesCounter.java b/server/src/main/java/org/apache/iotdb/db/conf/adapter/ActiveTimeSeriesCounter.java
new file mode 100644
index 0000000..376eeb4
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/conf/adapter/ActiveTimeSeriesCounter.java
@@ -0,0 +1,34 @@
+/*
+ * 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.iotdb.db.conf.adapter;
+
+public class ActiveTimeSeriesCounter implements IActiveTimeSeriesCounter {
+
+    @Override public void clear() {
+
+    }
+
+    @Override public void offer(String storageGroup, String device, String measurement) {
+
+    }
+
+    @Override public double getActiveRatio(String storageGroup) {
+        return 0;
+    }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/adapter/IActiveTimeSeriesCounter.java b/server/src/main/java/org/apache/iotdb/db/conf/adapter/IActiveTimeSeriesCounter.java
new file mode 100644
index 0000000..76d4f74
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/conf/adapter/IActiveTimeSeriesCounter.java
@@ -0,0 +1,45 @@
+/*
+ * 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.iotdb.db.conf.adapter;
+
+public interface IActiveTimeSeriesCounter {
+
+    /**
+     * Clear the active time series counter
+     */
+    void clear();
+
+    /**
+     * Register a time series to the active time series counter
+     *
+     * @param storageGroup the storage group name of the time series
+     * @param device the device name of the time series
+     * @param measurement the sensor name of the time series
+     */
+    void offer(String storageGroup, String device, String measurement);
+
+    /**
+     * Get the active time series number proportion of the given storage group
+     *
+     * @param storageGroup the storage group to be calculated
+     * @return the active time series number proportion of the given storage group
+     */
+    double getActiveRatio(String storageGroup);
+
+}