blob: 5695f9a13b382eccf41c59b7acc0bc6258aac0f0 [file] [log] [blame]
#ifndef THIRD_PARTY_MILOTIC_EXTERNAL_CC_HFT_ADAPTER_DATA_SOURCE_H_
#define THIRD_PARTY_MILOTIC_EXTERNAL_CC_HFT_ADAPTER_DATA_SOURCE_H_
#include <memory>
#include <vector>
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/time/time.h"
#include "tlbmc/types/identifier.proto.h"
#include "payload.pb.h"
#include "subscription_params.pb.h"
namespace milotic_hft {
class DataSource {
public:
virtual ~DataSource() = default;
// Configures the data source for the given `identifier` with the given
// `sampling_interval_ms`.
// `max_buffer_size` is the maximum number of readings that the data source
// should buffer.
// Returns an error if the data source cannot be configured.
virtual absl::Status ConfigureSamplingInterval(const Identifier& identifier,
int sampling_interval_ms) = 0;
// Configures the data source for the given `identifier` with the given
// `max_batch_size`.
// Returns an error if the data source cannot be configured.
virtual absl::Status ConfigureBatchSize(const Identifier& identifier,
int max_batch_size) = 0;
// Resets the data source to the default configuration for the given
// `identifier`.
virtual absl::Status ResetSamplingIntervalToDefault(
const Identifier& identifier) = 0;
// Resets the batch size to the default configuration for the given
// `identifier`.
virtual absl::Status ResetBatchSizeToDefault(
const Identifier& identifier) = 0;
// Collects the data from the data source for the given `identifier` since the
// `start_time`.
// Returns an error if the data source is cannot serve the data.
virtual absl::StatusOr<Payload> Collect(const Identifier& identifier,
absl::Time start_time) const = 0;
virtual absl::StatusOr<std::vector<Identifier>> GetIdentifiersForResourceType(
const SubscriptionPolicy::ResourceType& resource_type) const = 0;
};
} // namespace milotic_hft
#endif // THIRD_PARTY_MILOTIC_EXTERNAL_CC_HFT_ADAPTER_DATA_SOURCE_H_