MCPcopy Create free account
hub / github.com/comaps/comaps / DownloadNode

Method DownloadNode

libs/storage/storage.cpp:1604–1630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1602}
1603
1604void Storage::DownloadNode(CountryId const & countryId, bool isUpdate /* = false */)
1605{
1606 CHECK_THREAD_CHECKER(m_threadChecker, ());
1607
1608 LOG(LINFO, ("Downloading", countryId));
1609
1610 CountryTree::Node const * const node = m_countries.FindFirst(countryId);
1611
1612 if (!node)
1613 return;
1614
1615 if (GetNodeStatus(*node).status == NodeStatus::OnDisk)
1616 return;
1617
1618 auto downloadAction = [this, isUpdate](CountryTree::Node const & descendantNode)
1619 {
1620 if (descendantNode.ChildrenCount() == 0 && GetNodeStatus(descendantNode).status != NodeStatus::OnDisk)
1621 {
1622 auto const countryId = descendantNode.Value().Name();
1623 auto const fileType = isUpdate && m_diffsDataSource->HasDiffFor(countryId) ? MapFileType::Diff : MapFileType::Map;
1624
1625 DownloadCountry(countryId, fileType);
1626 }
1627 };
1628
1629 node->ForEachInSubtree(downloadAction);
1630}
1631
1632void Storage::DeleteNode(CountryId const & countryId)
1633{

Callers 12

mainFunction · 0.80
OnItemClickMethod · 0.80
OnDownloadClickedMethod · 0.80
UNIT_TESTFunction · 0.80
UNIT_TESTFunction · 0.80
UNIT_CLASS_TESTFunction · 0.80
UNIT_CLASS_TESTFunction · 0.80
DownloadGroupFunction · 0.80
UNIT_TESTFunction · 0.80
UNIT_CLASS_TESTFunction · 0.80
RunGraphicsBenchmarkFunction · 0.80

Calls 6

FindFirstMethod · 0.80
ChildrenCountMethod · 0.80
HasDiffForMethod · 0.80
NameMethod · 0.45
ValueMethod · 0.45
ForEachInSubtreeMethod · 0.45

Tested by 7

UNIT_TESTFunction · 0.64
UNIT_TESTFunction · 0.64
UNIT_CLASS_TESTFunction · 0.64
UNIT_CLASS_TESTFunction · 0.64
DownloadGroupFunction · 0.64
UNIT_TESTFunction · 0.64
UNIT_CLASS_TESTFunction · 0.64