MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / writeFileLocation

Method writeFileLocation

Telegram/SourceFiles/storage/storage_account.cpp:1754–1794  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1752}
1753
1754void Account::writeFileLocation(MediaKey location, const Core::FileLocation &local) {
1755 if (local.fname.isEmpty()) {
1756 return;
1757 }
1758 if (!local.inMediaCache()) {
1759 const auto aliasIt = _fileLocationAliases.constFind(location);
1760 if (aliasIt != _fileLocationAliases.cend()) {
1761 location = aliasIt.value();
1762 }
1763
1764 const auto i = _fileLocationPairs.find(local.fname);
1765 if (i != _fileLocationPairs.cend()) {
1766 if (i.value().second == local) {
1767 if (i.value().first != location) {
1768 _fileLocationAliases.insert(location, i.value().first);
1769 writeLocationsQueued();
1770 }
1771 return;
1772 }
1773 if (i.value().first != location) {
1774 for (auto j = _fileLocations.find(i.value().first), e = _fileLocations.end(); (j != e) && (j.key() == i.value().first); ++j) {
1775 if (j.value() == i.value().second) {
1776 _fileLocations.erase(j);
1777 break;
1778 }
1779 }
1780 _fileLocationPairs.erase(i);
1781 }
1782 }
1783 _fileLocationPairs.insert(local.fname, { location, local });
1784 } else {
1785 for (auto i = _fileLocations.find(location); (i != _fileLocations.end()) && (i.key() == location);) {
1786 if (i.value().inMediaCache() || i.value().check()) {
1787 return;
1788 }
1789 i = _fileLocations.erase(i);
1790 }
1791 }
1792 _fileLocations.insert(location, local);
1793 writeLocationsQueued();
1794}
1795
1796void Account::removeFileLocation(MediaKey location) {
1797 auto i = _fileLocations.find(location);

Callers 8

setLoadedInMediaCacheMethod · 0.80
saveMethod · 0.80
saveFromDataCheckedMethod · 0.80
setRemoteLocationMethod · 0.80
collectLocalDataMethod · 0.80
setLocationMethod · 0.80
uploadMethod · 0.80
finalizeResultMethod · 0.80

Calls 10

inMediaCacheMethod · 0.80
isEmptyMethod · 0.45
cendMethod · 0.45
valueMethod · 0.45
findMethod · 0.45
insertMethod · 0.45
endMethod · 0.45
keyMethod · 0.45
eraseMethod · 0.45
checkMethod · 0.45

Tested by

no test coverage detected