| #ifndef THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_HAL_NIC_VEEPROM_INTERFACE_H_ |
| #define THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_HAL_NIC_VEEPROM_INTERFACE_H_ |
| |
| #include <memory> |
| #include <string> |
| |
| #include "absl/status/statusor.h" |
| #include "veeprom.pb.h" |
| #include "sensor.pb.h" |
| |
| namespace milotic_tlbmc::nic_veeprom { |
| |
| // Accessor is the interface for reading and writing virtual EEPROM data from a |
| // Google NIC. |
| class Accessor { |
| public: |
| virtual ~Accessor() = default; |
| |
| // Do a refresh immediately and update internal data buffer and timestamps |
| // The implementation should do a batch read for all telemetry supported by |
| // the specified version to increase efficiency. |
| // The implementation must be blocking and must be thread-safe. |
| virtual void DoRefresh() = 0; |
| |
| // Given a telemetry name, returns the most recent SensorValue. |
| // The implementation must be blocking and must be thread-safe. |
| virtual absl::StatusOr<std::shared_ptr<const SensorValue>> GetSensorValue( |
| NicTelemetryName name) const = 0; |
| |
| // Creates an accessor for the given veeprom version, bus and address. |
| static std::unique_ptr<Accessor> Create(NicTelemetryVersion version, |
| int bus, int address); |
| }; |
| |
| } // namespace milotic_tlbmc::nic_veeprom |
| |
| #endif // THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_HAL_NIC_VEEPROM_INTERFACE_H_ |