1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
/// Peer metadata.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Peer {
    /// Peer id.
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    /// Range is url range of request.
    #[prost(message, optional, tag = "2")]
    pub range: ::core::option::Option<Range>,
    /// Peer priority.
    #[prost(enumeration = "Priority", tag = "3")]
    pub priority: i32,
    /// Pieces of peer.
    #[prost(message, repeated, tag = "4")]
    pub pieces: ::prost::alloc::vec::Vec<Piece>,
    /// Peer downloads costs time.
    #[prost(message, optional, tag = "5")]
    pub cost: ::core::option::Option<::prost_types::Duration>,
    /// Peer state.
    #[prost(string, tag = "6")]
    pub state: ::prost::alloc::string::String,
    /// Task info.
    #[prost(message, optional, tag = "7")]
    pub task: ::core::option::Option<Task>,
    /// Host info.
    #[prost(message, optional, tag = "8")]
    pub host: ::core::option::Option<Host>,
    /// NeedBackToSource needs downloaded from source.
    #[prost(bool, tag = "9")]
    pub need_back_to_source: bool,
    /// Peer create time.
    #[prost(message, optional, tag = "10")]
    pub created_at: ::core::option::Option<::prost_types::Timestamp>,
    /// Peer update time.
    #[prost(message, optional, tag = "11")]
    pub updated_at: ::core::option::Option<::prost_types::Timestamp>,
}
/// Task metadata.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Task {
    /// Task id.
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    /// Task type.
    #[prost(enumeration = "TaskType", tag = "2")]
    pub r#type: i32,
    /// Download url.
    #[prost(string, tag = "3")]
    pub url: ::prost::alloc::string::String,
    /// Digest of the pieces digest, for example md5:xxx or sha256:yyy.
    #[prost(string, tag = "4")]
    pub digest: ::prost::alloc::string::String,
    /// URL tag identifies different task for same url.
    #[prost(string, tag = "5")]
    pub tag: ::prost::alloc::string::String,
    /// Application of task.
    #[prost(string, tag = "6")]
    pub application: ::prost::alloc::string::String,
    /// Filter url used to generate task id.
    #[prost(string, repeated, tag = "7")]
    pub filters: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    /// Task request headers.
    #[prost(map = "string, string", tag = "8")]
    pub header: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
    /// Task piece length.
    #[prost(int32, tag = "9")]
    pub piece_length: i32,
    /// Task content length.
    #[prost(int64, tag = "10")]
    pub content_length: i64,
    /// Task piece count.
    #[prost(int32, tag = "11")]
    pub piece_count: i32,
    /// Task size scope.
    #[prost(enumeration = "SizeScope", tag = "12")]
    pub size_scope: i32,
    /// Pieces of task.
    #[prost(message, repeated, tag = "13")]
    pub pieces: ::prost::alloc::vec::Vec<Piece>,
    /// Task state.
    #[prost(string, tag = "14")]
    pub state: ::prost::alloc::string::String,
    /// Task peer count.
    #[prost(int32, tag = "15")]
    pub peer_count: i32,
    /// Task contains available peer.
    #[prost(bool, tag = "16")]
    pub has_available_peer: bool,
    /// Task create time.
    #[prost(message, optional, tag = "17")]
    pub created_at: ::core::option::Option<::prost_types::Timestamp>,
    /// Task update time.
    #[prost(message, optional, tag = "18")]
    pub updated_at: ::core::option::Option<::prost_types::Timestamp>,
}
/// Host metadata.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Host {
    /// Host id.
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    /// Host type.
    #[prost(uint32, tag = "2")]
    pub r#type: u32,
    /// Hostname.
    #[prost(string, tag = "3")]
    pub hostname: ::prost::alloc::string::String,
    /// Host ip.
    #[prost(string, tag = "4")]
    pub ip: ::prost::alloc::string::String,
    /// Port of grpc service.
    #[prost(int32, tag = "5")]
    pub port: i32,
    /// Port of download server.
    #[prost(int32, tag = "6")]
    pub download_port: i32,
    /// Host OS.
    #[prost(string, tag = "7")]
    pub os: ::prost::alloc::string::String,
    /// Host platform.
    #[prost(string, tag = "8")]
    pub platform: ::prost::alloc::string::String,
    /// Host platform family.
    #[prost(string, tag = "9")]
    pub platform_family: ::prost::alloc::string::String,
    /// Host platform version.
    #[prost(string, tag = "10")]
    pub platform_version: ::prost::alloc::string::String,
    /// Host kernel version.
    #[prost(string, tag = "11")]
    pub kernel_version: ::prost::alloc::string::String,
    /// CPU Stat.
    #[prost(message, optional, tag = "12")]
    pub cpu: ::core::option::Option<Cpu>,
    /// Memory Stat.
    #[prost(message, optional, tag = "13")]
    pub memory: ::core::option::Option<Memory>,
    /// Network Stat.
    #[prost(message, optional, tag = "14")]
    pub network: ::core::option::Option<Network>,
    /// Disk Stat.
    #[prost(message, optional, tag = "15")]
    pub disk: ::core::option::Option<Disk>,
    /// Build information.
    #[prost(message, optional, tag = "16")]
    pub build: ::core::option::Option<Build>,
}
/// CPU Stat.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Cpu {
    /// Number of logical cores in the system.
    #[prost(uint32, tag = "1")]
    pub logical_count: u32,
    /// Number of physical cores in the system
    #[prost(uint32, tag = "2")]
    pub physical_count: u32,
    /// Percent calculates the percentage of cpu used.
    #[prost(double, tag = "3")]
    pub percent: f64,
    /// Calculates the percentage of cpu used by process.
    #[prost(double, tag = "4")]
    pub process_percent: f64,
    /// CPUTimes contains the amounts of time the CPU has spent performing different kinds of work.
    #[prost(message, optional, tag = "5")]
    pub times: ::core::option::Option<CpuTimes>,
}
/// CPUTimes contains the amounts of time the CPU has spent performing different
/// kinds of work. Time units are in seconds.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CpuTimes {
    /// CPU time of user.
    #[prost(double, tag = "1")]
    pub user: f64,
    /// CPU time of system.
    #[prost(double, tag = "2")]
    pub system: f64,
    /// CPU time of idle.
    #[prost(double, tag = "3")]
    pub idle: f64,
    /// CPU time of nice.
    #[prost(double, tag = "4")]
    pub nice: f64,
    /// CPU time of iowait.
    #[prost(double, tag = "5")]
    pub iowait: f64,
    /// CPU time of irq.
    #[prost(double, tag = "6")]
    pub irq: f64,
    /// CPU time of softirq.
    #[prost(double, tag = "7")]
    pub softirq: f64,
    /// CPU time of steal.
    #[prost(double, tag = "8")]
    pub steal: f64,
    /// CPU time of guest.
    #[prost(double, tag = "9")]
    pub guest: f64,
    /// CPU time of guest nice.
    #[prost(double, tag = "10")]
    pub guest_nice: f64,
}
/// Memory Stat.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Memory {
    /// Total amount of RAM on this system.
    #[prost(uint64, tag = "1")]
    pub total: u64,
    /// RAM available for programs to allocate.
    #[prost(uint64, tag = "2")]
    pub available: u64,
    /// RAM used by programs.
    #[prost(uint64, tag = "3")]
    pub used: u64,
    /// Percentage of RAM used by programs.
    #[prost(double, tag = "4")]
    pub used_percent: f64,
    /// Calculates the percentage of memory used by process.
    #[prost(double, tag = "5")]
    pub process_used_percent: f64,
    /// This is the kernel's notion of free memory.
    #[prost(uint64, tag = "6")]
    pub free: u64,
}
/// Network Stat.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Network {
    /// Return count of tcp connections opened and status is ESTABLISHED.
    #[prost(uint32, tag = "1")]
    pub tcp_connection_count: u32,
    /// Return count of upload tcp connections opened and status is ESTABLISHED.
    #[prost(uint32, tag = "2")]
    pub upload_tcp_connection_count: u32,
    /// Location path(area|country|province|city|...).
    #[prost(string, tag = "3")]
    pub location: ::prost::alloc::string::String,
    /// IDC where the peer host is located
    #[prost(string, tag = "4")]
    pub idc: ::prost::alloc::string::String,
}
/// Disk Stat.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Disk {
    /// Total amount of disk on the data path of dragonfly.
    #[prost(uint64, tag = "1")]
    pub total: u64,
    /// Free amount of disk on the data path of dragonfly.
    #[prost(uint64, tag = "2")]
    pub free: u64,
    /// Used amount of disk on the data path of dragonfly.
    #[prost(uint64, tag = "3")]
    pub used: u64,
    /// Used percent of disk on the data path of dragonfly directory.
    #[prost(double, tag = "4")]
    pub used_percent: f64,
    /// Total amount of indoes on the data path of dragonfly directory.
    #[prost(uint64, tag = "5")]
    pub inodes_total: u64,
    /// Used amount of indoes on the data path of dragonfly directory.
    #[prost(uint64, tag = "6")]
    pub inodes_used: u64,
    /// Free amount of indoes on the data path of dragonfly directory.
    #[prost(uint64, tag = "7")]
    pub inodes_free: u64,
    /// Used percent of indoes on the data path of dragonfly directory.
    #[prost(double, tag = "8")]
    pub inodes_used_percent: f64,
}
/// Build information.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Build {
    /// Git version.
    #[prost(string, tag = "1")]
    pub git_version: ::prost::alloc::string::String,
    /// Git commit.
    #[prost(string, tag = "2")]
    pub git_commit: ::prost::alloc::string::String,
    /// Golang version.
    #[prost(string, tag = "3")]
    pub go_version: ::prost::alloc::string::String,
    /// Build platform.
    #[prost(string, tag = "4")]
    pub platform: ::prost::alloc::string::String,
}
/// Download information.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Download {
    /// Download url.
    #[prost(string, tag = "1")]
    pub url: ::prost::alloc::string::String,
    /// Digest of the pieces digest, for example md5:xxx or sha256:yyy.
    #[prost(string, tag = "2")]
    pub digest: ::prost::alloc::string::String,
    /// Range is url range of request.
    #[prost(message, optional, tag = "3")]
    pub range: ::core::option::Option<Range>,
    /// Task type.
    #[prost(enumeration = "TaskType", tag = "4")]
    pub r#type: i32,
    /// URL tag identifies different task for same url.
    #[prost(string, tag = "5")]
    pub tag: ::prost::alloc::string::String,
    /// Application of task.
    #[prost(string, tag = "6")]
    pub application: ::prost::alloc::string::String,
    /// Peer priority.
    #[prost(enumeration = "Priority", tag = "7")]
    pub priority: i32,
    /// Filter url used to generate task id.
    #[prost(string, repeated, tag = "8")]
    pub filters: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    /// Task request headers.
    #[prost(map = "string, string", tag = "9")]
    pub header: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
    /// Task piece length.
    #[prost(int32, tag = "10")]
    pub piece_length: i32,
    /// File path to be exported.
    #[prost(string, tag = "11")]
    pub output_path: ::prost::alloc::string::String,
    /// Download timeout.
    #[prost(message, optional, tag = "12")]
    pub timeout: ::core::option::Option<::prost_types::Duration>,
    /// Download rate limit in bytes per second.
    #[prost(double, tag = "13")]
    pub download_rate_limit: f64,
    /// NeedBackToSource needs downloaded from source.
    #[prost(bool, tag = "14")]
    pub need_back_to_source: bool,
}
/// Range represents download range.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Range {
    /// Start of range.
    #[prost(int64, tag = "1")]
    pub start: i64,
    /// Length of range.
    #[prost(int64, tag = "2")]
    pub length: i64,
}
/// Piece represents information of piece.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Piece {
    /// Piece number.
    #[prost(int32, tag = "1")]
    pub number: i32,
    /// Parent peer id.
    #[prost(string, tag = "2")]
    pub parent_id: ::prost::alloc::string::String,
    /// Piece offset.
    #[prost(uint64, tag = "3")]
    pub offset: u64,
    /// Piece length.
    #[prost(uint64, tag = "4")]
    pub length: u64,
    /// Digest of the piece data, for example md5:xxx or sha256:yyy.
    #[prost(string, tag = "5")]
    pub digest: ::prost::alloc::string::String,
    /// Piece content.
    #[prost(bytes = "vec", tag = "6")]
    pub content: ::prost::alloc::vec::Vec<u8>,
    /// Traffic type.
    #[prost(enumeration = "TrafficType", tag = "7")]
    pub traffic_type: i32,
    /// Downloading piece costs time.
    #[prost(message, optional, tag = "8")]
    pub cost: ::core::option::Option<::prost_types::Duration>,
    /// Piece create time.
    #[prost(message, optional, tag = "9")]
    pub created_at: ::core::option::Option<::prost_types::Timestamp>,
}
/// SizeScope represents size scope of task.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SizeScope {
    /// size > one piece size.
    Normal = 0,
    /// 128 byte < size <= one piece size and be plain type.
    Small = 1,
    /// size <= 128 byte and be plain type.
    Tiny = 2,
    /// size == 0 byte and be plain type.
    Empty = 3,
}
impl SizeScope {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            SizeScope::Normal => "NORMAL",
            SizeScope::Small => "SMALL",
            SizeScope::Tiny => "TINY",
            SizeScope::Empty => "EMPTY",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "NORMAL" => Some(Self::Normal),
            "SMALL" => Some(Self::Small),
            "TINY" => Some(Self::Tiny),
            "EMPTY" => Some(Self::Empty),
            _ => None,
        }
    }
}
/// TaskType represents type of task.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum TaskType {
    /// DFDAEMON is dfdeamon type of task,
    /// dfdeamon task is a normal p2p task.
    Dfdaemon = 0,
    /// DFCACHE is dfcache type of task,
    /// dfcache task is a cache task, and the task url is fake url.
    /// It can only be used for caching and cannot be downloaded back to source.
    Dfcache = 1,
    /// DFSTORE is dfstore type of task,
    /// dfstore task is a persistent task in backend.
    Dfstore = 2,
}
impl TaskType {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            TaskType::Dfdaemon => "DFDAEMON",
            TaskType::Dfcache => "DFCACHE",
            TaskType::Dfstore => "DFSTORE",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "DFDAEMON" => Some(Self::Dfdaemon),
            "DFCACHE" => Some(Self::Dfcache),
            "DFSTORE" => Some(Self::Dfstore),
            _ => None,
        }
    }
}
/// TrafficType represents type of traffic.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum TrafficType {
    /// BACK_TO_SOURCE is to download traffic from the source.
    BackToSource = 0,
    /// REMOTE_PEER is to download traffic from the remote peer.
    RemotePeer = 1,
    /// LOCAL_PEER is to download traffic from the local peer.
    LocalPeer = 2,
}
impl TrafficType {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            TrafficType::BackToSource => "BACK_TO_SOURCE",
            TrafficType::RemotePeer => "REMOTE_PEER",
            TrafficType::LocalPeer => "LOCAL_PEER",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "BACK_TO_SOURCE" => Some(Self::BackToSource),
            "REMOTE_PEER" => Some(Self::RemotePeer),
            "LOCAL_PEER" => Some(Self::LocalPeer),
            _ => None,
        }
    }
}
/// Priority represents priority of application.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Priority {
    /// LEVEL0 has no special meaning for scheduler.
    Level0 = 0,
    /// LEVEL1 represents the download task is forbidden,
    /// and an error code is returned during the registration.
    Level1 = 1,
    /// LEVEL2 represents when the task is downloaded for the first time,
    /// allow peers to download from the other peers,
    /// but not back-to-source. When the task is not downloaded for
    /// the first time, it is scheduled normally.
    Level2 = 2,
    /// LEVEL3 represents when the task is downloaded for the first time,
    /// the normal peer is first to download back-to-source.
    /// When the task is not downloaded for the first time, it is scheduled normally.
    Level3 = 3,
    /// LEVEL4 represents when the task is downloaded for the first time,
    /// the weak peer is first triggered to back-to-source.
    /// When the task is not downloaded for the first time, it is scheduled normally.
    Level4 = 4,
    /// LEVEL5 represents when the task is downloaded for the first time,
    /// the strong peer is first triggered to back-to-source.
    /// When the task is not downloaded for the first time, it is scheduled normally.
    Level5 = 5,
    /// LEVEL6 represents when the task is downloaded for the first time,
    /// the super peer is first triggered to back-to-source.
    /// When the task is not downloaded for the first time, it is scheduled normally.
    Level6 = 6,
}
impl Priority {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Priority::Level0 => "LEVEL0",
            Priority::Level1 => "LEVEL1",
            Priority::Level2 => "LEVEL2",
            Priority::Level3 => "LEVEL3",
            Priority::Level4 => "LEVEL4",
            Priority::Level5 => "LEVEL5",
            Priority::Level6 => "LEVEL6",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "LEVEL0" => Some(Self::Level0),
            "LEVEL1" => Some(Self::Level1),
            "LEVEL2" => Some(Self::Level2),
            "LEVEL3" => Some(Self::Level3),
            "LEVEL4" => Some(Self::Level4),
            "LEVEL5" => Some(Self::Level5),
            "LEVEL6" => Some(Self::Level6),
            _ => None,
        }
    }
}