Package edu.ie3.datamodel.io.sink
Class InfluxDbSink
java.lang.Object
edu.ie3.datamodel.io.sink.InfluxDbSink
- All Implemented Interfaces:
DataSink,OutputDataSink
InfluxDB Sink for result and time series data
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInfluxDbSink(InfluxDbConnector connector) Initializes a new InfluxDbWeatherSource with a default EntityPersistenceNamingStrategyInfluxDbSink(InfluxDbConnector connector, EntityPersistenceNamingStrategy entityPersistenceNamingStrategy) Initializes a new InfluxDbWeatherSource -
Method Summary
Modifier and TypeMethodDescriptionvoidflush()If batch writing is enabled, this call writes everything inside the batch to the database.<C extends UniqueEntity>
voidpersist(C entity) Should implement the entry point of a data sink to persist an entity.<C extends UniqueEntity>
voidpersistAll(Collection<C> entities) Should implement the entry point of a data sink to persist multiple entities in a collection.<E extends TimeSeriesEntry<V>,V extends Value>
voidpersistTimeSeries(TimeSeries<E, V> timeSeries) Should implement the handling of a whole time series.voidshutdown()Shutdown this sink and do all cleanup operations (e.g.
-
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 connectionentityPersistenceNamingStrategy- needed to create measurement names for entities
-
InfluxDbSink
Initializes a new InfluxDbWeatherSource with a default EntityPersistenceNamingStrategy- Parameters:
connector- needed for database connection
-
-
Method Details
-
shutdown
public void shutdown()Description copied from interface:DataSinkShutdown this sink and do all cleanup operations (e.g. closing of theDataConnector) here -
persist
Description copied from interface:DataSinkShould 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 useExtractoraccordingly. 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 useInputDataSink.persistIgnoreNested(C)- Specified by:
persistin interfaceDataSink- Type Parameters:
C- bounded to be all unique entities. Handling of specific entities is normally then executed by a specificEntityProcessor- Parameters:
entity- the entity that should be persisted
-
persistAll
Description copied from interface:DataSinkShould 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 useExtractoraccordingly. 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 useInputDataSink.persistAllIgnoreNested(java.util.Collection<C>)- Specified by:
persistAllin interfaceDataSink- Type Parameters:
C- bounded to be all unique entities. Handling of specific entities is normally then executed by a specificEntityProcessor- 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:DataSinkShould implement the handling of a whole time series. Therefore the single entries have to be extracted and persisted accordingly.- Specified by:
persistTimeSeriesin interfaceDataSink- Type Parameters:
E- Type of entry in the time seriesV- 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.
-