TDLib
Loading...
Searching...
No Matches
ClientActor.h
Go to the documentation of this file.
1//
2// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2026
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"
14
15#include "td/actor/actor.h"
16
17#include "td/utils/common.h"
18
19#include <memory>
20
21namespace td {
22
23class NetQueryStats;
24class Td;
25
30class ClientActor final : public Actor {
31 public:
33 struct Options {
35 std::shared_ptr<NetQueryStats> net_query_stats;
36
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 &) = delete;
80
81 ClientActor &operator=(const ClientActor &) = delete;
82
83 private:
84 void start_up() final;
85
86 ActorOwn<Td> td_;
87 unique_ptr<TdCallback> callback_;
88 Options options_;
89};
90
94std::shared_ptr<NetQueryStats> create_net_query_stats();
95
100void dump_pending_network_queries(NetQueryStats &stats);
101
106uint64 get_pending_network_query_count(NetQueryStats &stats);
107
108} // namespace td
std::shared_ptr< NetQueryStats > create_net_query_stats()
void dump_pending_network_queries(NetQueryStats &stats)
uint64 get_pending_network_query_count(NetQueryStats &stats)
~ClientActor() final
static td_api::object_ptr< td_api::Object > execute(td_api::object_ptr< td_api::Function > request)
ClientActor(unique_ptr< TdCallback > callback, Options options={})
void request(uint64 id, td_api::object_ptr< td_api::Function > request)
Definition TdCallback.h:20
Options for ClientActor creation.
Definition ClientActor.h:33
Options()
Default constructor.
Definition ClientActor.h:38
std::shared_ptr< NetQueryStats > net_query_stats
NetQueryStats object for this client.
Definition ClientActor.h:35