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
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2017-09-13 16:57:44 +00:00
|
|
|
#include <rpl/producer.h>
|
2017-09-04 11:40:02 +00:00
|
|
|
#include "base/enum_mask.h"
|
|
|
|
|
2018-01-09 17:08:31 +00:00
|
|
|
namespace Data {
|
|
|
|
struct MessagesResult;
|
|
|
|
} // namespace Data
|
|
|
|
|
2017-09-04 11:40:02 +00:00
|
|
|
namespace Storage {
|
|
|
|
|
2017-10-29 15:32:01 +00:00
|
|
|
struct SparseIdsListResult;
|
|
|
|
|
2017-09-04 11:40:02 +00:00
|
|
|
struct SharedMediaAddNew;
|
|
|
|
struct SharedMediaAddExisting;
|
|
|
|
struct SharedMediaAddSlice;
|
|
|
|
struct SharedMediaRemoveOne;
|
|
|
|
struct SharedMediaRemoveAll;
|
2018-02-05 14:37:22 +00:00
|
|
|
struct SharedMediaInvalidateBottom;
|
2017-09-04 11:40:02 +00:00
|
|
|
struct SharedMediaQuery;
|
2020-10-20 16:29:24 +00:00
|
|
|
struct SharedMediaKey;
|
2017-10-29 15:32:01 +00:00
|
|
|
using SharedMediaResult = SparseIdsListResult;
|
2017-08-18 19:14:31 +00:00
|
|
|
struct SharedMediaSliceUpdate;
|
2017-09-04 11:40:02 +00:00
|
|
|
|
2017-08-29 19:52:52 +00:00
|
|
|
struct UserPhotosAddNew;
|
|
|
|
struct UserPhotosAddSlice;
|
|
|
|
struct UserPhotosRemoveOne;
|
|
|
|
struct UserPhotosRemoveAfter;
|
|
|
|
struct UserPhotosQuery;
|
|
|
|
struct UserPhotosResult;
|
|
|
|
struct UserPhotosSliceUpdate;
|
|
|
|
|
2017-09-04 11:40:02 +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);
|
2018-02-05 14:37:22 +00:00
|
|
|
void invalidate(SharedMediaInvalidateBottom &&query);
|
2017-09-04 11:40:02 +00:00
|
|
|
|
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
|
|
|
|
2017-09-04 11:40:02 +00:00
|
|
|
~Facade();
|
|
|
|
|
|
|
|
private:
|
|
|
|
class Impl;
|
|
|
|
const std::unique_ptr<Impl> _impl;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Storage
|