Additional level 2 data provider functionality for display of latest data

This commit is contained in:
Dan Paulat 2022-05-28 02:04:59 -05:00
parent 57e5badd70
commit 4b9d12a7ef
3 changed files with 147 additions and 24 deletions

View file

@ -29,12 +29,19 @@ public:
size_t cache_size() const;
std::chrono::system_clock::time_point last_modified() const;
std::chrono::seconds update_period() const;
std::string FindKey(std::chrono::system_clock::time_point time);
std::string FindLatestKey();
std::pair<size_t, size_t>
ListObjects(std::chrono::system_clock::time_point date);
std::shared_ptr<wsr88d::Ar2vFile> LoadObjectByKey(const std::string& key);
size_t Refresh();
std::chrono::system_clock::time_point
GetTimePointByKey(const std::string& key) const;
static std::chrono::system_clock::time_point
GetTimePointFromKey(const std::string& key);

View file

@ -27,6 +27,23 @@ public:
virtual size_t cache_size() const = 0;
/**
* Gets the last modified time. This is equal to the most recent object's
* modification time. If there are no objects, the epoch is returned.
*
* @return Last modified time
*/
virtual std::chrono::system_clock::time_point last_modified() const = 0;
/**
* Gets the current update period. This is equal to the difference between
* the last two objects' modification times. If there are less than two
* objects, an update period of 0 is returned.
*
* @return Update period
*/
virtual std::chrono::seconds update_period() const = 0;
/**
* Finds the most recent key in the cache, no later than the time provided.
*
@ -36,6 +53,13 @@ public:
*/
virtual std::string FindKey(std::chrono::system_clock::time_point time) = 0;
/**
* Finds the most recent key in the cache.
*
* @return Level 2 data key
*/
virtual std::string FindLatestKey() = 0;
/**
* Lists level 2 objects for the date supplied, and adds them to the cache.
*
@ -66,6 +90,16 @@ public:
*/
virtual size_t Refresh() = 0;
/**
* Convert the object key to a time point.
*
* @key Level 2 data key
*
* @return Level 2 data time point
*/
virtual std::chrono::system_clock::time_point
GetTimePointByKey(const std::string& key) const = 0;
private:
std::unique_ptr<Level2DataProviderImpl> p;
};