| #ifndef THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_STORE_STORE_HFT_ADAPTER_H_ |
| #define THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_STORE_STORE_HFT_ADAPTER_H_ |
| |
| #include <memory> |
| #include <vector> |
| |
| #include "absl/status/status.h" |
| #include "absl/status/statusor.h" |
| #include "absl/time/time.h" |
| #include "tlbmc/adapter/data_source.h" |
| #include "identifier.pb.h" |
| #include "payload.pb.h" |
| #include "sensor_identifier.pb.h" |
| #include "subscription_params.pb.h" |
| #include "sensor.pb.h" |
| #include "tlbmc/store/store.h" |
| |
| namespace milotic_tlbmc { |
| |
| // Simple helper function to convert a SensorUnit to a HFT SensorUnits. |
| milotic_hft::SensorUnits ConvertToHftUnit(SensorUnit unit); |
| |
| // An adapter to the Store interface for the High Frequency Telemetry (HFT) |
| // framework. |
| class StoreHftAdapter : public milotic_hft::DataSource { |
| public: |
| static absl::StatusOr<std::unique_ptr<StoreHftAdapter>> Create(Store* store); |
| |
| absl::Status ConfigureSamplingInterval( |
| const milotic_hft::Identifier& identifier, |
| int sampling_interval_ms) override; |
| |
| absl::Status ConfigureBatchSize(const milotic_hft::Identifier& identifier, |
| int max_batch_size) override; |
| |
| absl::Status ResetBatchSizeToDefault( |
| const milotic_hft::Identifier& identifier) override; |
| |
| absl::Status ResetSamplingIntervalToDefault( |
| const milotic_hft::Identifier& identifier) override; |
| |
| absl::StatusOr<milotic_hft::Payload> Collect( |
| const milotic_hft::Identifier& identifier, |
| absl::Time start_time) const override; |
| |
| absl::StatusOr<std::vector<milotic_hft::Identifier>> |
| GetIdentifiersForResourceType( |
| const milotic_hft::SubscriptionPolicy::ResourceType& resource_type) |
| const override; |
| |
| private: |
| explicit StoreHftAdapter(Store* store) : store_(store) {} |
| |
| Store* store_; |
| }; |
| |
| } // namespace milotic_tlbmc |
| |
| #endif // THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_STORE_STORE_HFT_ADAPTER_H_ |