2017-09-04 11:40:02 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2017-09-04 11:40:02 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2017-09-04 11:40:02 +00:00
|
|
|
*/
|
|
|
|
#include "storage/storage_facade.h"
|
|
|
|
|
|
|
|
#include "storage/storage_shared_media.h"
|
2017-08-29 19:52:52 +00:00
|
|
|
#include "storage/storage_user_photos.h"
|
2019-04-15 11:54:03 +00:00
|
|
|
//#include "storage/storage_feed_messages.h" // #feed
|
2017-09-04 11:40:02 +00:00
|
|
|
|
|
|
|
namespace Storage {
|
|
|
|
|
|
|
|
class Facade::Impl {
|
|
|
|
public:
|
|
|
|
void add(SharedMediaAddNew &&query);
|
|
|
|
void add(SharedMediaAddExisting &&query);
|
|
|
|
void add(SharedMediaAddSlice &&query);
|
|
|
|
void remove(SharedMediaRemoveOne &&query);
|
|
|
|
void remove(SharedMediaRemoveAll &&query);
|
2018-02-05 14:37:22 +00:00
|
|
|
void invalidate(SharedMediaInvalidateBottom &&query);
|
2017-09-04 19:14:44 +00:00
|
|
|
rpl::producer<SharedMediaResult> query(SharedMediaQuery &&query) const;
|
2020-10-20 16:29:24 +00:00
|
|
|
SharedMediaResult snapshot(const SharedMediaQuery &query) const;
|
|
|
|
bool empty(const SharedMediaKey &key) const;
|
2017-09-04 19:14:44 +00:00
|
|
|
rpl::producer<SharedMediaSliceUpdate> sharedMediaSliceUpdated() const;
|
|
|
|
rpl::producer<SharedMediaRemoveOne> sharedMediaOneRemoved() const;
|
|
|
|
rpl::producer<SharedMediaRemoveAll> sharedMediaAllRemoved() const;
|
2018-02-05 14:37:22 +00:00
|
|
|
rpl::producer<SharedMediaInvalidateBottom> sharedMediaBottomInvalidated() const;
|
2017-08-18 19:14:31 +00:00
|
|
|
|
2017-08-29 19:52:52 +00:00
|
|
|
void add(UserPhotosAddNew &&query);
|
|
|
|
void add(UserPhotosAddSlice &&query);
|
|
|
|
void remove(UserPhotosRemoveOne &&query);
|
|
|
|
void remove(UserPhotosRemoveAfter &&query);
|
2017-09-06 14:50:11 +00:00
|
|
|
rpl::producer<UserPhotosResult> query(UserPhotosQuery &&query) const;
|
|
|
|
rpl::producer<UserPhotosSliceUpdate> userPhotosSliceUpdated() const;
|
2017-08-29 19:52:52 +00:00
|
|
|
|
2019-04-15 11:54:03 +00:00
|
|
|
//void add(FeedMessagesAddNew &&query); // #feed
|
|
|
|
//void add(FeedMessagesAddSlice &&query);
|
|
|
|
//void remove(FeedMessagesRemoveOne &&query);
|
|
|
|
//void remove(FeedMessagesRemoveAll &&query);
|
|
|
|
//void invalidate(FeedMessagesInvalidate &&query);
|
|
|
|
//void invalidate(FeedMessagesInvalidateBottom &&query);
|
|
|
|
//rpl::producer<FeedMessagesResult> query(
|
|
|
|
// FeedMessagesQuery &&query) const;
|
|
|
|
//rpl::producer<FeedMessagesSliceUpdate> feedMessagesSliceUpdated() const;
|
|
|
|
//rpl::producer<FeedMessagesRemoveOne> feedMessagesOneRemoved() const;
|
|
|
|
//rpl::producer<FeedMessagesRemoveAll> feedMessagesAllRemoved() const;
|
|
|
|
//rpl::producer<FeedMessagesInvalidate> feedMessagesInvalidated() const;
|
|
|
|
//rpl::producer<FeedMessagesInvalidateBottom> feedMessagesBottomInvalidated() const;
|
2018-01-09 17:08:31 +00:00
|
|
|
|
2017-09-04 11:40:02 +00:00
|
|
|
private:
|
|
|
|
SharedMedia _sharedMedia;
|
2017-08-29 19:52:52 +00:00
|
|
|
UserPhotos _userPhotos;
|
2019-04-15 11:54:03 +00:00
|
|
|
//FeedMessages _feedMessages; // #feed
|
2017-09-04 11:40:02 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
void Facade::Impl::add(SharedMediaAddNew &&query) {
|
|
|
|
_sharedMedia.add(std::move(query));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Facade::Impl::add(SharedMediaAddExisting &&query) {
|
|
|
|
_sharedMedia.add(std::move(query));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Facade::Impl::add(SharedMediaAddSlice &&query) {
|
|
|
|
_sharedMedia.add(std::move(query));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Facade::Impl::remove(SharedMediaRemoveOne &&query) {
|
|
|
|
_sharedMedia.remove(std::move(query));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Facade::Impl::remove(SharedMediaRemoveAll &&query) {
|
|
|
|
_sharedMedia.remove(std::move(query));
|
|
|
|
}
|
|
|
|
|
2018-02-05 14:37:22 +00:00
|
|
|
void Facade::Impl::invalidate(SharedMediaInvalidateBottom &&query) {
|
|
|
|
_sharedMedia.invalidate(std::move(query));
|
|
|
|
}
|
|
|
|
|
2017-09-04 19:14:44 +00:00
|
|
|
rpl::producer<SharedMediaResult> Facade::Impl::query(SharedMediaQuery &&query) const {
|
|
|
|
return _sharedMedia.query(std::move(query));
|
2017-09-04 11:40:02 +00:00
|
|
|
}
|
|
|
|
|
2020-10-20 16:29:24 +00:00
|
|
|
SharedMediaResult Facade::Impl::snapshot(const SharedMediaQuery &query) const {
|
|
|
|
return _sharedMedia.snapshot(query);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Facade::Impl::empty(const SharedMediaKey &key) const {
|
|
|
|
return _sharedMedia.empty(key);
|
|
|
|
}
|
|
|
|
|
2017-09-04 19:14:44 +00:00
|
|
|
rpl::producer<SharedMediaSliceUpdate> Facade::Impl::sharedMediaSliceUpdated() const {
|
|
|
|
return _sharedMedia.sliceUpdated();
|
2017-08-18 19:14:31 +00:00
|
|
|
}
|
|
|
|
|
2017-09-04 19:14:44 +00:00
|
|
|
rpl::producer<SharedMediaRemoveOne> Facade::Impl::sharedMediaOneRemoved() const {
|
|
|
|
return _sharedMedia.oneRemoved();
|
2017-08-18 19:14:31 +00:00
|
|
|
}
|
|
|
|
|
2017-09-04 19:14:44 +00:00
|
|
|
rpl::producer<SharedMediaRemoveAll> Facade::Impl::sharedMediaAllRemoved() const {
|
|
|
|
return _sharedMedia.allRemoved();
|
2017-08-18 19:14:31 +00:00
|
|
|
}
|
2017-09-04 11:40:02 +00:00
|
|
|
|
2018-02-05 14:37:22 +00:00
|
|
|
rpl::producer<SharedMediaInvalidateBottom> Facade::Impl::sharedMediaBottomInvalidated() const {
|
|
|
|
return _sharedMedia.bottomInvalidated();
|
|
|
|
}
|
|
|
|
|
2017-08-29 19:52:52 +00:00
|
|
|
void Facade::Impl::add(UserPhotosAddNew &&query) {
|
|
|
|
return _userPhotos.add(std::move(query));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Facade::Impl::add(UserPhotosAddSlice &&query) {
|
|
|
|
return _userPhotos.add(std::move(query));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Facade::Impl::remove(UserPhotosRemoveOne &&query) {
|
|
|
|
return _userPhotos.remove(std::move(query));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Facade::Impl::remove(UserPhotosRemoveAfter &&query) {
|
|
|
|
return _userPhotos.remove(std::move(query));
|
|
|
|
}
|
|
|
|
|
2017-09-06 14:50:11 +00:00
|
|
|
rpl::producer<UserPhotosResult> Facade::Impl::query(UserPhotosQuery &&query) const {
|
|
|
|
return _userPhotos.query(std::move(query));
|
2017-08-29 19:52:52 +00:00
|
|
|
}
|
|
|
|
|
2017-09-06 14:50:11 +00:00
|
|
|
rpl::producer<UserPhotosSliceUpdate> Facade::Impl::userPhotosSliceUpdated() const {
|
|
|
|
return _userPhotos.sliceUpdated();
|
2017-08-29 19:52:52 +00:00
|
|
|
}
|
2019-04-15 11:54:03 +00:00
|
|
|
// // #feed
|
|
|
|
//void Facade::Impl::add(FeedMessagesAddNew &&query) {
|
|
|
|
// return _feedMessages.add(std::move(query));
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//void Facade::Impl::add(FeedMessagesAddSlice &&query) {
|
|
|
|
// return _feedMessages.add(std::move(query));
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//void Facade::Impl::remove(FeedMessagesRemoveOne &&query) {
|
|
|
|
// return _feedMessages.remove(std::move(query));
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//void Facade::Impl::remove(FeedMessagesRemoveAll &&query) {
|
|
|
|
// return _feedMessages.remove(std::move(query));
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//void Facade::Impl::invalidate(FeedMessagesInvalidate &&query) {
|
|
|
|
// return _feedMessages.invalidate(std::move(query));
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//void Facade::Impl::invalidate(FeedMessagesInvalidateBottom &&query) {
|
|
|
|
// return _feedMessages.invalidate(std::move(query));
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//rpl::producer<FeedMessagesResult> Facade::Impl::query(
|
|
|
|
// FeedMessagesQuery &&query) const {
|
|
|
|
// return _feedMessages.query(std::move(query));
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//rpl::producer<FeedMessagesSliceUpdate> Facade::Impl::feedMessagesSliceUpdated() const {
|
|
|
|
// return _feedMessages.sliceUpdated();
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//rpl::producer<FeedMessagesRemoveOne> Facade::Impl::feedMessagesOneRemoved() const {
|
|
|
|
// return _feedMessages.oneRemoved();
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//rpl::producer<FeedMessagesRemoveAll> Facade::Impl::feedMessagesAllRemoved() const {
|
|
|
|
// return _feedMessages.allRemoved();
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//rpl::producer<FeedMessagesInvalidate> Facade::Impl::feedMessagesInvalidated() const {
|
|
|
|
// return _feedMessages.invalidated();
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//rpl::producer<FeedMessagesInvalidateBottom> Facade::Impl::feedMessagesBottomInvalidated() const {
|
|
|
|
// return _feedMessages.bottomInvalidated();
|
|
|
|
//}
|
2018-02-05 14:37:22 +00:00
|
|
|
|
2017-09-04 11:40:02 +00:00
|
|
|
Facade::Facade() : _impl(std::make_unique<Impl>()) {
|
|
|
|
}
|
|
|
|
|
|
|
|
void Facade::add(SharedMediaAddNew &&query) {
|
|
|
|
_impl->add(std::move(query));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Facade::add(SharedMediaAddExisting &&query) {
|
|
|
|
_impl->add(std::move(query));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Facade::add(SharedMediaAddSlice &&query) {
|
|
|
|
_impl->add(std::move(query));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Facade::remove(SharedMediaRemoveOne &&query) {
|
|
|
|
_impl->remove(std::move(query));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Facade::remove(SharedMediaRemoveAll &&query) {
|
|
|
|
_impl->remove(std::move(query));
|
|
|
|
}
|
|
|
|
|
2018-02-05 14:37:22 +00:00
|
|
|
void Facade::invalidate(SharedMediaInvalidateBottom &&query) {
|
|
|
|
_impl->invalidate(std::move(query));
|
|
|
|
}
|
|
|
|
|
2017-09-04 19:14:44 +00:00
|
|
|
rpl::producer<SharedMediaResult> Facade::query(SharedMediaQuery &&query) const {
|
|
|
|
return _impl->query(std::move(query));
|
2017-09-04 11:40:02 +00:00
|
|
|
}
|
|
|
|
|
2020-10-20 16:29:24 +00:00
|
|
|
SharedMediaResult Facade::snapshot(const SharedMediaQuery &query) const {
|
|
|
|
return _impl->snapshot(query);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Facade::empty(const SharedMediaKey &key) const {
|
|
|
|
return _impl->empty(key);
|
|
|
|
}
|
|
|
|
|
2017-09-04 19:14:44 +00:00
|
|
|
rpl::producer<SharedMediaSliceUpdate> Facade::sharedMediaSliceUpdated() const {
|
2017-08-18 19:14:31 +00:00
|
|
|
return _impl->sharedMediaSliceUpdated();
|
|
|
|
}
|
|
|
|
|
2017-09-04 19:14:44 +00:00
|
|
|
rpl::producer<SharedMediaRemoveOne> Facade::sharedMediaOneRemoved() const {
|
2017-08-18 19:14:31 +00:00
|
|
|
return _impl->sharedMediaOneRemoved();
|
|
|
|
}
|
|
|
|
|
2017-09-04 19:14:44 +00:00
|
|
|
rpl::producer<SharedMediaRemoveAll> Facade::sharedMediaAllRemoved() const {
|
2017-08-18 19:14:31 +00:00
|
|
|
return _impl->sharedMediaAllRemoved();
|
|
|
|
}
|
|
|
|
|
2018-02-05 14:37:22 +00:00
|
|
|
rpl::producer<SharedMediaInvalidateBottom> Facade::sharedMediaBottomInvalidated() const {
|
|
|
|
return _impl->sharedMediaBottomInvalidated();
|
|
|
|
}
|
|
|
|
|
2017-08-29 19:52:52 +00:00
|
|
|
void Facade::add(UserPhotosAddNew &&query) {
|
|
|
|
return _impl->add(std::move(query));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Facade::add(UserPhotosAddSlice &&query) {
|
|
|
|
return _impl->add(std::move(query));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Facade::remove(UserPhotosRemoveOne &&query) {
|
|
|
|
return _impl->remove(std::move(query));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Facade::remove(UserPhotosRemoveAfter &&query) {
|
|
|
|
return _impl->remove(std::move(query));
|
|
|
|
}
|
|
|
|
|
2017-09-06 14:50:11 +00:00
|
|
|
rpl::producer<UserPhotosResult> Facade::query(UserPhotosQuery &&query) const {
|
|
|
|
return _impl->query(std::move(query));
|
2017-08-29 19:52:52 +00:00
|
|
|
}
|
|
|
|
|
2017-09-06 14:50:11 +00:00
|
|
|
rpl::producer<UserPhotosSliceUpdate> Facade::userPhotosSliceUpdated() const {
|
2017-08-29 19:52:52 +00:00
|
|
|
return _impl->userPhotosSliceUpdated();
|
|
|
|
}
|
2019-04-15 11:54:03 +00:00
|
|
|
// // #feed
|
|
|
|
//void Facade::add(FeedMessagesAddNew &&query) {
|
|
|
|
// return _impl->add(std::move(query));
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//void Facade::add(FeedMessagesAddSlice &&query) {
|
|
|
|
// return _impl->add(std::move(query));
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//void Facade::remove(FeedMessagesRemoveOne &&query) {
|
|
|
|
// return _impl->remove(std::move(query));
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//void Facade::remove(FeedMessagesRemoveAll &&query) {
|
|
|
|
// return _impl->remove(std::move(query));
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//void Facade::invalidate(FeedMessagesInvalidate &&query) {
|
|
|
|
// return _impl->invalidate(std::move(query));
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//void Facade::invalidate(FeedMessagesInvalidateBottom &&query) {
|
|
|
|
// return _impl->invalidate(std::move(query));
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//rpl::producer<FeedMessagesResult> Facade::query(
|
|
|
|
// FeedMessagesQuery &&query) const {
|
|
|
|
// return _impl->query(std::move(query));
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//rpl::producer<FeedMessagesSliceUpdate> Facade::feedMessagesSliceUpdated() const {
|
|
|
|
// return _impl->feedMessagesSliceUpdated();
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//rpl::producer<FeedMessagesRemoveOne> Facade::feedMessagesOneRemoved() const {
|
|
|
|
// return _impl->feedMessagesOneRemoved();
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//rpl::producer<FeedMessagesRemoveAll> Facade::feedMessagesAllRemoved() const {
|
|
|
|
// return _impl->feedMessagesAllRemoved();
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//rpl::producer<FeedMessagesInvalidate> Facade::feedMessagesInvalidated() const {
|
|
|
|
// return _impl->feedMessagesInvalidated();
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//rpl::producer<FeedMessagesInvalidateBottom> Facade::feedMessagesBottomInvalidated() const {
|
|
|
|
// return _impl->feedMessagesBottomInvalidated();
|
|
|
|
//}
|
2018-02-05 14:37:22 +00:00
|
|
|
|
2017-09-04 11:40:02 +00:00
|
|
|
Facade::~Facade() = default;
|
|
|
|
|
|
|
|
} // namespace Storage
|