Remove some unneded methods added in level_2_chunks

This commit is contained in:
AdenKoperczak 2025-04-21 19:44:31 -04:00
parent 759a9e4379
commit 2daf4d8ba4
No known key found for this signature in database
GPG key ID: 9843017036F62EE7
5 changed files with 12 additions and 53 deletions

View file

@ -53,9 +53,7 @@ public:
LoadObjectByKey(const std::string& key) override; LoadObjectByKey(const std::string& key) override;
std::shared_ptr<wsr88d::NexradFile> std::shared_ptr<wsr88d::NexradFile>
LoadObjectByTime(std::chrono::system_clock::time_point time) override; LoadObjectByTime(std::chrono::system_clock::time_point time) override;
std::shared_ptr<wsr88d::NexradFile> LoadLatestObject() override; std::pair<size_t, size_t> Refresh() override;
std::shared_ptr<wsr88d::NexradFile> LoadSecondLatestObject() override;
std::pair<size_t, size_t> Refresh() override;
void RequestAvailableProducts() override; void RequestAvailableProducts() override;
std::vector<std::string> GetAvailableProducts() override; std::vector<std::string> GetAvailableProducts() override;

View file

@ -48,8 +48,6 @@ public:
LoadObjectByKey(const std::string& key) override; LoadObjectByKey(const std::string& key) override;
std::shared_ptr<wsr88d::NexradFile> std::shared_ptr<wsr88d::NexradFile>
LoadObjectByTime(std::chrono::system_clock::time_point time) override; LoadObjectByTime(std::chrono::system_clock::time_point time) override;
std::shared_ptr<wsr88d::NexradFile> LoadLatestObject() override;
std::shared_ptr<wsr88d::NexradFile> LoadSecondLatestObject() override;
std::pair<size_t, size_t> Refresh() override; std::pair<size_t, size_t> Refresh() override;
protected: protected:

View file

@ -98,20 +98,6 @@ public:
virtual std::shared_ptr<wsr88d::NexradFile> virtual std::shared_ptr<wsr88d::NexradFile>
LoadObjectByTime(std::chrono::system_clock::time_point time) = 0; LoadObjectByTime(std::chrono::system_clock::time_point time) = 0;
/**
* Loads the latest NEXRAD file object
*
* @return NEXRAD data
*/
virtual std::shared_ptr<wsr88d::NexradFile> LoadLatestObject() = 0;
/**
* Loads the second NEXRAD file object
*
* @return NEXRAD data
*/
virtual std::shared_ptr<wsr88d::NexradFile> LoadSecondLatestObject() = 0;
/** /**
* Lists NEXRAD objects for the current date, and adds them to the cache. If * Lists NEXRAD objects for the current date, and adds them to the cache. If
* no objects have been added to the cache for the current date, the previous * no objects have been added to the cache for the current date, the previous

View file

@ -205,16 +205,20 @@ size_t AwsLevel2ChunksDataProvider::cache_size() const
std::chrono::system_clock::time_point std::chrono::system_clock::time_point
AwsLevel2ChunksDataProvider::last_modified() const AwsLevel2ChunksDataProvider::last_modified() const
{ {
// There is a slight delay between the "modified time" and when it is
// actually available. Radar product manager uses this as available time
static const auto extra = std::chrono::seconds(2);
const std::shared_lock lock(p->scansMutex_); const std::shared_lock lock(p->scansMutex_);
if (p->currentScan_.valid_ && p->currentScan_.lastModified_ != if (p->currentScan_.valid_ && p->currentScan_.lastModified_ !=
std::chrono::system_clock::time_point {}) std::chrono::system_clock::time_point {})
{ {
return p->currentScan_.lastModified_; return p->currentScan_.lastModified_ + extra;
} }
else if (p->lastScan_.valid_ && p->lastScan_.lastModified_ != else if (p->lastScan_.valid_ && p->lastScan_.lastModified_ !=
std::chrono::system_clock::time_point {}) std::chrono::system_clock::time_point {})
{ {
return p->lastScan_.lastModified_; return p->lastScan_.lastModified_ + extra;
} }
else else
{ {
@ -224,20 +228,18 @@ AwsLevel2ChunksDataProvider::last_modified() const
std::chrono::seconds AwsLevel2ChunksDataProvider::update_period() const std::chrono::seconds AwsLevel2ChunksDataProvider::update_period() const
{ {
const std::shared_lock lock(p->scansMutex_); const std::shared_lock lock(p->scansMutex_);
// Add an extra second of delay
static const auto extra = std::chrono::seconds(2);
// get update period from time between chunks // get update period from time between chunks
if (p->currentScan_.valid_ && p->currentScan_.nextFile_ > 2) if (p->currentScan_.valid_ && p->currentScan_.nextFile_ > 2)
{ {
auto delta = auto delta =
p->currentScan_.lastModified_ - p->currentScan_.secondLastModified_; p->currentScan_.lastModified_ - p->currentScan_.secondLastModified_;
return std::chrono::duration_cast<std::chrono::seconds>(delta) + extra; return std::chrono::duration_cast<std::chrono::seconds>(delta);
} }
else if (p->lastScan_.valid_ && p->lastScan_.nextFile_ > 2) else if (p->lastScan_.valid_ && p->lastScan_.nextFile_ > 2)
{ {
auto delta = auto delta =
p->lastScan_.lastModified_ - p->lastScan_.secondLastModified_; p->lastScan_.lastModified_ - p->lastScan_.secondLastModified_;
return std::chrono::duration_cast<std::chrono::seconds>(delta) + extra; return std::chrono::duration_cast<std::chrono::seconds>(delta);
} }
// default to a set update period // default to a set update period
@ -645,20 +647,6 @@ AwsLevel2ChunksDataProvider::LoadObjectByTime(
} }
} }
std::shared_ptr<wsr88d::NexradFile>
AwsLevel2ChunksDataProvider::LoadLatestObject()
{
const std::unique_lock lock(p->scansMutex_);
return std::make_shared<wsr88d::Ar2vFile>(p->currentScan_.nexradFile_,
p->lastScan_.nexradFile_);
}
std::shared_ptr<wsr88d::NexradFile>
AwsLevel2ChunksDataProvider::LoadSecondLatestObject()
{
return p->lastScan_.nexradFile_;
}
int AwsLevel2ChunksDataProvider::Impl::GetScanNumber(const std::string& prefix) int AwsLevel2ChunksDataProvider::Impl::GetScanNumber(const std::string& prefix)
{ {
// KIND/585/20250324-134727-001-S // KIND/585/20250324-134727-001-S
@ -728,7 +716,7 @@ std::pair<size_t, size_t> AwsLevel2ChunksDataProvider::Refresh()
}); });
} }
threadPool.wait(); threadPool.join();
if (newCurrent) if (newCurrent)
{ {
newObjects += 1; newObjects += 1;
@ -759,7 +747,7 @@ std::optional<float> AwsLevel2ChunksDataProvider::GetCurrentElevation()
{ {
if (!p->currentScan_.valid_ || p->currentScan_.nexradFile_ == nullptr) if (!p->currentScan_.valid_ || p->currentScan_.nexradFile_ == nullptr)
{ {
// Does not have any scan elevation. -90 is beyond what is possible // Does not have any scan elevation.
return {}; return {};
} }
@ -767,7 +755,7 @@ std::optional<float> AwsLevel2ChunksDataProvider::GetCurrentElevation()
auto radarData = p->currentScan_.nexradFile_->radar_data(); auto radarData = p->currentScan_.nexradFile_->radar_data();
if (radarData.size() == 0) if (radarData.size() == 0)
{ {
// Does not have any scan elevation. -90 is beyond what is possible // Does not have any scan elevation.
return {}; return {};
} }

View file

@ -346,17 +346,6 @@ std::shared_ptr<wsr88d::NexradFile> AwsNexradDataProvider::LoadObjectByTime(
} }
} }
std::shared_ptr<wsr88d::NexradFile> AwsNexradDataProvider::LoadLatestObject()
{
return LoadObjectByKey(FindLatestKey());
}
std::shared_ptr<wsr88d::NexradFile>
AwsNexradDataProvider::LoadSecondLatestObject()
{
return nullptr;
}
std::pair<size_t, size_t> AwsNexradDataProvider::Refresh() std::pair<size_t, size_t> AwsNexradDataProvider::Refresh()
{ {
using namespace std::chrono; using namespace std::chrono;