| 1602 | } |
| 1603 | |
| 1604 | void 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 | |
| 1632 | void Storage::DeleteNode(CountryId const & countryId) |
| 1633 | { |