]> git.basschouten.com Git - openhab-addons.git/blob
00ea9146d5b8aeff752d9890e91f77672a3ca6e2
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.persistence.influxdb.internal;
14
15 import java.util.List;
16 import java.util.Map;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19
20 /**
21  * Manages InfluxDB server interaction maintaining client connection
22  *
23  * @author Joan Pujol Espinar - Initial contribution
24  */
25 @NonNullByDefault
26 public interface InfluxDBRepository {
27     /**
28      * Returns if the client is successfully connected to server
29      *
30      * @return True if it's connected, otherwise false
31      */
32     boolean isConnected();
33
34     /**
35      * Connect to InfluxDB server
36      *
37      * @return True if successful, otherwise false
38      */
39     boolean connect();
40
41     /**
42      * Disconnect from InfluxDB server
43      */
44     void disconnect();
45
46     /**
47      * Check if connection is currently ready
48      *
49      * @return True if its ready, otherwise false
50      */
51     boolean checkConnectionStatus();
52
53     /**
54      * Return all stored item names with it's count of stored points
55      *
56      * @return Map with <ItemName,ItemCount> entries
57      */
58     Map<String, Integer> getStoredItemsCount();
59
60     /**
61      * Executes Flux query
62      *
63      * @param query Query
64      * @return Query results
65      */
66     List<InfluxRow> query(String query);
67
68     /**
69      * Write point to database
70      *
71      * @param influxPoint Point to write
72      */
73     void write(InfluxPoint influxPoint);
74 }