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;
20 import org.openhab.core.persistence.FilterCriteria;
23 * Manages InfluxDB server interaction maintaining client connection
25 * @author Joan Pujol Espinar - Initial contribution
28 public interface InfluxDBRepository {
30 * Returns if the client is successfully connected to server
32 * @return True if it's connected, otherwise false
34 boolean isConnected();
37 * Connect to InfluxDB server
39 * @return <code>true</code> if successful, otherwise <code>false</code>
44 * Disconnect from InfluxDB server
49 * Check if connection is currently ready
51 * @return True if it's ready, otherwise false
53 boolean checkConnectionStatus();
56 * Return all stored item names with its count of stored points
58 * @return Map with {@code <ItemName,ItemCount>} entries
60 Map<String, Integer> getStoredItemsCount();
65 * @param filter the query filter
66 * @return Query results
69 List<InfluxRow> query(FilterCriteria filter, String retentionPolicy);
72 * Write points to database
74 * @param influxPoints {@link List<InfluxPoint>} to write
75 * @return <code>true</code> if points have been written, <code>false</code> otherwise
77 boolean write(List<InfluxPoint> influxPoints);
80 * Execute delete query
82 * @param filter the query filter
83 * @return <code>true</code> if query executed successfully, <code>false</code> otherwise
85 boolean remove(FilterCriteria filter);
87 record InfluxRow(Instant time, String itemName, Object value) {