Class InfluxDbSink

java.lang.Object
edu.ie3.datamodel.io.sink.InfluxDbSink
All Implemented Interfaces:
DataSink, OutputDataSink

public class InfluxDbSink extends Object implements OutputDataSink
InfluxDB Sink for result and time series data
  • Field Details

    • log

      public static final org.slf4j.Logger log
  • Constructor Details

    • InfluxDbSink

      public InfluxDbSink(InfluxDbConnector connector, EntityPersistenceNamingStrategy entityPersistenceNamingStrategy)
      Initializes a new InfluxDbWeatherSource
      Parameters:
      connector - needed for database connection
      entityPersistenceNamingStrategy - needed to create measurement names for entities
    • InfluxDbSink

      public InfluxDbSink(InfluxDbConnector connector)
      Initializes a new InfluxDbWeatherSource with a default EntityPersistenceNamingStrategy
      Parameters:
      connector - needed for database connection
  • Method Details

    • shutdown

      public void shutdown()
      Description copied from interface: DataSink
      Shutdown this sink and do all cleanup operations (e.g. closing of the DataConnector) here
      Specified by:
      shutdown in interface DataSink
    • persist

      public <C extends UniqueEntity> void persist(C entity)
      Description copied from interface: DataSink
      Should implement the entry point of a data sink to persist an entity. By default this method should take care about the extraction process of nested entities (if any) of input entities and use Extractor accordingly. For an faster method e.g. that neglects the nested objects persistence and only persists the uuid of the nested objects (if any), instead of the object itself use InputDataSink.persistIgnoreNested(C)
      Specified by:
      persist in interface DataSink
      Type Parameters:
      C - bounded to be all unique entities. Handling of specific entities is normally then executed by a specific EntityProcessor
      Parameters:
      entity - the entity that should be persisted
    • persistAll

      public <C extends UniqueEntity> void persistAll(Collection<C> entities)
      Description copied from interface: DataSink
      Should implement the entry point of a data sink to persist multiple entities in a collection. By default this method should take care about the extraction process of nested entities (if any) of input entities and use Extractor accordingly. For a faster method that neglects the nested objects persistence and only persists the uuid of the nested * objects (if any), instead of the object itself use InputDataSink.persistAllIgnoreNested(java.util.Collection<C>)
      Specified by:
      persistAll in interface DataSink
      Type Parameters:
      C - bounded to be all unique entities. Handling of specific entities is normally then executed by a specific EntityProcessor
      Parameters:
      entities - a collection of entities that should be persisted
    • persistTimeSeries

      public <E extends TimeSeriesEntry<V>, V extends Value> void persistTimeSeries(TimeSeries<E,V> timeSeries)
      Description copied from interface: DataSink
      Should implement the handling of a whole time series. Therefore the single entries have to be extracted and persisted accordingly.
      Specified by:
      persistTimeSeries in interface DataSink
      Type Parameters:
      E - Type of entry in the time series
      V - Type of actual value, that is inside the entry
      Parameters:
      timeSeries - Time series to persist
    • flush

      public void flush()
      If batch writing is enabled, this call writes everything inside the batch to the database. This will block until all pending points are written.