// // Copyright Andrea Cavalli (nospam@warp.ovh) 2020 // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #pragma once #include "td/actor/actor.h" #include "td/actor/MultiPromise.h" #include "td/actor/PromiseFuture.h" #include "td/actor/Timeout.h" #include "td/telegram/files/FileId.h" #include "td/telegram/files/FileSourceId.h" #include "td/telegram/FullMessageId.h" #include "td/telegram/Photo.h" #include "td/telegram/SecretInputMedia.h" #include "td/utils/buffer.h" #include "td/utils/common.h" #include "td/utils/Hints.h" #include "td/utils/Slice.h" #include "td/utils/Status.h" #include "td/telegram/td_api.h" #include "td/telegram/telegram_api.h" #include #include #include #include #include namespace td { class Td; struct MemoryStats { string debug; MemoryStats() = default; explicit MemoryStats(string debug) : debug(std::move(debug)) { } tl_object_ptr get_memory_statistics_object() const; }; class MemoryManager : public Actor { public: MemoryManager(Td *td, ActorShared<> parent); bool can_manage_memory() const; static bool do_session_settings_allow_for_memory_management(); void get_memory_stats(bool full, Promise promise) const; void clean_memory(bool full, Promise promise) const; void get_current_state(vector> &updates) const; private: void start_up() override; void tear_down() override; Td *td_; ActorShared<> parent_; }; } // namespace td