ClientActor.h
Go to the documentation of this file.
1 //
2 // Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2021
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 #pragma once
8 
10 
11 #include "td/telegram/td_api.h"
12 #include "td/telegram/td_api.hpp"
13 #include "td/telegram/TdCallback.h"
14 
15 #include "td/actor/actor.h"
16 
17 #include "td/utils/common.h"
18 
19 #include <memory>
20 
21 namespace td {
22 
23 class NetQueryStats;
24 class Td;
25 
30 class ClientActor final : public Actor {
31  public:
33  struct Options {
35  std::shared_ptr<NetQueryStats> net_query_stats;
36 
38  Options() {
39  }
40  };
41 
47  explicit ClientActor(unique_ptr<TdCallback> callback, Options options = {});
48 
54  void request(uint64 id, td_api::object_ptr<td_api::Function> request);
55 
62  static td_api::object_ptr<td_api::Object> execute(td_api::object_ptr<td_api::Function> request);
63 
67  ~ClientActor() final;
68 
72  ClientActor(ClientActor &&other) noexcept;
73 
77  ClientActor &operator=(ClientActor &&other) noexcept;
78 
79  ClientActor(const ClientActor &other) = delete;
80 
81  ClientActor &operator=(const ClientActor &other) = delete;
82 
83  private:
84  ActorOwn<Td> td_;
85 };
86 
90 std::shared_ptr<NetQueryStats> create_net_query_stats();
91 
96 void dump_pending_network_queries(NetQueryStats &stats);
97 
102 uint64 get_pending_network_query_count(NetQueryStats &stats);
103 
104 } // namespace td
~ClientActor() final
void request(uint64 id, td_api::object_ptr< td_api::Function > request)
std::shared_ptr< NetQueryStats > net_query_stats
NetQueryStats object for this client.
Definition: ClientActor.h:35
Options for ClientActor creation.
Definition: ClientActor.h:33
ClientActor(unique_ptr< TdCallback > callback, Options options={})
Options()
Default constructor.
Definition: ClientActor.h:38
Definition: ClientActor.h:30
static td_api::object_ptr< td_api::Object > execute(td_api::object_ptr< td_api::Function > request)