2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.persistence.influxdb.internal;
15 import java.time.Instant;
16 import java.util.List;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
22 * Manages InfluxDB server interaction maintaining client connection
24 * @author Joan Pujol Espinar - Initial contribution
27 public interface InfluxDBRepository {
29 * Returns if the client is successfully connected to server
31 * @return True if it's connected, otherwise false
33 boolean isConnected();
36 * Connect to InfluxDB server
38 * @return <code>true</code> if successful, otherwise <code>false</code>
43 * Disconnect from InfluxDB server
48 * Check if connection is currently ready
50 * @return True if it's ready, otherwise false
52 boolean checkConnectionStatus();
55 * Return all stored item names with its count of stored points
57 * @return Map with <ItemName,ItemCount> entries
59 Map<String, Integer> getStoredItemsCount();
65 * @return Query results
68 List<InfluxRow> query(String query);
71 * Write points to database
73 * @param influxPoints {@link List<InfluxPoint>} to write
74 * @returns <code>true</code> if points have been written, <code>false</code> otherwise
76 boolean write(List<InfluxPoint> influxPoints);
79 * create a query creator on this repository
81 * @return the query creator for this repository
83 FilterCriteriaQueryCreator createQueryCreator();
85 record InfluxRow(Instant time, String itemName, Object value) {