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
-
Constructor Summary
ConstructorDescriptionInfluxDbSink
(InfluxDbConnector connector) Initializes a new InfluxDbWeatherSource with a default EntityPersistenceNamingStrategyInfluxDbSink
(InfluxDbConnector connector, EntityPersistenceNamingStrategy entityPersistenceNamingStrategy) Initializes a new InfluxDbWeatherSource -
Method Summary
Modifier and TypeMethodDescriptionvoid
flush()
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.void
shutdown()
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:DataSink
Shutdown this sink and do all cleanup operations (e.g. closing of theDataConnector
) here -
persist
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 useExtractor
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 useInputDataSink.persistIgnoreNested(C)
- Specified by:
persist
in 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: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 useExtractor
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 useInputDataSink.persistAllIgnoreNested(java.util.Collection<C>)
- Specified by:
persistAll
in 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: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 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.
-