Directory: | cvmfs/ |
---|---|
File: | cvmfs/network/jobinfo.cc |
Date: | 2025-02-09 02:34:19 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 48 | 57 | 84.2% |
Branches: | 2 | 14 | 14.3% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /** | ||
2 | * This file is part of the CernVM File System. | ||
3 | */ | ||
4 | |||
5 | #include "jobinfo.h" | ||
6 | #include "util/string.h" | ||
7 | |||
8 | namespace download { | ||
9 | |||
10 | atomic_int64 JobInfo::next_uuid = 0; | ||
11 | |||
12 | 169 | JobInfo::JobInfo(const std::string *u, const bool c, const bool ph, | |
13 |
1/2✓ Branch 2 taken 169 times.
✗ Branch 3 not taken.
|
169 | const shash::Any *h, cvmfs::Sink *s) { |
14 |
1/2✓ Branch 1 taken 169 times.
✗ Branch 2 not taken.
|
169 | Init(); |
15 | |||
16 | 169 | url_ = u; | |
17 | 169 | compressed_ = c; | |
18 | 169 | probe_hosts_ = ph; | |
19 | 169 | expected_hash_ = h; | |
20 | 169 | sink_ = s; | |
21 | 169 | } | |
22 | |||
23 | ✗ | JobInfo::JobInfo(const std::string *u, const bool ph) { | |
24 | ✗ | Init(); | |
25 | |||
26 | ✗ | url_ = u; | |
27 | ✗ | probe_hosts_ = ph; | |
28 | ✗ | head_request_ = true; | |
29 | } | ||
30 | |||
31 | |||
32 | ✗ | bool JobInfo::IsFileNotFound() { | |
33 | ✗ | if (HasPrefix(*url_, "file://", true /* ignore_case */)) | |
34 | ✗ | return error_code_ == kFailHostConnection; | |
35 | |||
36 | ✗ | return http_code_ == 404; | |
37 | } | ||
38 | |||
39 | 200 | void JobInfo::Init() { | |
40 | 200 | id_ = atomic_xadd64(&next_uuid, 1); | |
41 | 200 | pipe_job_results = NULL; | |
42 | 200 | url_ = NULL; | |
43 | 200 | compressed_ = false; | |
44 | 200 | probe_hosts_ = false; | |
45 | 200 | head_request_ = false; | |
46 | 200 | follow_redirects_ = false; | |
47 | 200 | force_nocache_ = false; | |
48 | 200 | pid_ = -1; | |
49 | 200 | uid_ = -1; | |
50 | 200 | gid_ = -1; | |
51 | 200 | cred_data_ = NULL; | |
52 | 200 | interrupt_cue_ = NULL; | |
53 | 200 | sink_ = NULL; | |
54 | 200 | expected_hash_ = NULL; | |
55 | 200 | extra_info_ = NULL; | |
56 | // | ||
57 | 200 | range_offset_ = -1; | |
58 | 200 | range_size_ = -1; | |
59 | // | ||
60 | 200 | curl_handle_ = NULL; | |
61 | 200 | headers_ = NULL; | |
62 | 200 | info_header_ = NULL; | |
63 | 200 | tracing_header_pid_ = NULL; | |
64 | 200 | tracing_header_gid_ = NULL; | |
65 | 200 | tracing_header_uid_ = NULL; | |
66 | 200 | nocache_ = false; | |
67 | 200 | error_code_ = kFailOther; | |
68 | 200 | http_code_ = -1; | |
69 | 200 | link_ = ""; | |
70 | 200 | num_used_proxies_ = 0; | |
71 | 200 | num_used_metalinks_ = 0; | |
72 | 200 | num_used_hosts_ = 0; | |
73 | 200 | num_retries_ = 0; | |
74 | 200 | backoff_ms_ = 0; | |
75 | 200 | current_metalink_chain_index_ = -1; | |
76 | 200 | current_host_chain_index_ = -1; | |
77 | |||
78 | 200 | allow_failure_ = false; | |
79 | |||
80 | 200 | memset(&zstream_, 0, sizeof(zstream_)); | |
81 | 200 | } | |
82 | |||
83 | } // namespace download | ||
84 |