tdesktop/Telegram/SourceFiles/storage/storage_facade.h

101 lines
3.1 KiB
C
Raw Normal View History

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
2017-09-13 16:57:44 +00:00
#include <rpl/producer.h>
#include "base/enum_mask.h"
2018-01-09 17:08:31 +00:00
namespace Data {
struct MessagesResult;
} // namespace Data
namespace Storage {
struct SparseIdsListResult;
struct SharedMediaAddNew;
struct SharedMediaAddExisting;
struct SharedMediaAddSlice;
struct SharedMediaRemoveOne;
struct SharedMediaRemoveAll;
struct SharedMediaInvalidateBottom;
struct SharedMediaQuery;
2020-10-20 16:29:24 +00:00
struct SharedMediaKey;
using SharedMediaResult = SparseIdsListResult;
struct SharedMediaSliceUpdate;
struct UserPhotosAddNew;
struct UserPhotosAddSlice;
struct UserPhotosRemoveOne;
struct UserPhotosRemoveAfter;
struct UserPhotosQuery;
struct UserPhotosResult;
struct UserPhotosSliceUpdate;
2019-04-15 11:54:03 +00:00
//struct FeedMessagesAddNew; // #feed
//struct FeedMessagesAddSlice;
//struct FeedMessagesRemoveOne;
//struct FeedMessagesRemoveAll;
//struct FeedMessagesInvalidate;
//struct FeedMessagesInvalidateBottom;
//struct FeedMessagesQuery;
//using FeedMessagesResult = Data::MessagesResult;
//struct FeedMessagesSliceUpdate;
2018-01-09 17:08:31 +00:00
class Facade {
public:
Facade();
void add(SharedMediaAddNew &&query);
void add(SharedMediaAddExisting &&query);
void add(SharedMediaAddSlice &&query);
void remove(SharedMediaRemoveOne &&query);
void remove(SharedMediaRemoveAll &&query);
void invalidate(SharedMediaInvalidateBottom &&query);
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;
rpl::producer<SharedMediaSliceUpdate> sharedMediaSliceUpdated() const;
rpl::producer<SharedMediaRemoveOne> sharedMediaOneRemoved() const;
rpl::producer<SharedMediaRemoveAll> sharedMediaAllRemoved() const;
rpl::producer<SharedMediaInvalidateBottom> sharedMediaBottomInvalidated() const;
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;
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
~Facade();
private:
class Impl;
const std::unique_ptr<Impl> _impl;
};
} // namespace Storage