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
//! Arguments for `decdn get <URI>` (#2449): one command for a blob, a whole
//! bundle, or one bundle entry, named by a `decdn:` URI
//! (`adr/appendix-bundles.md` ยง `decdn:` URIs).
//!
//! The URI stays a `String` here: `decdn-common` does not depend on
//! `decdn-client`, which owns the `DecdnUri` parser. The `cli` binary parses it
//! and routes the target to the blob fetch or the bundle pull.
use PathBuf;
use Args;
use ClientFetchArgs;
/// The default `--jobs` of a bundle pull.
pub const DEFAULT_JOBS: usize = 4;
/// The default `--max-lane-streams` of a bundle pull.
pub const DEFAULT_MAX_LANE_STREAMS: u16 = 4;
/// `decdn get` โ pull what a `decdn:` URI names over the paid `cdn/client/v1`
/// path.
///
/// - `decdn:<hash>`: the raw blob. `-o` is the destination file, or `-` for
/// stdout. Without `-o`, the blob lands at `./<hash>`.
/// - `decdn:<hash>/`: every entry of the bundle whose manifest has this hash.
/// `-o` is the output directory. Without `-o`, it is `.`.
/// - `decdn:<hash>/<path>`: that one bundle entry. `-o` is the output
/// directory, and the file lands at `<OUT>/<path>`. Without `-o`, the file
/// lands at `./<name>`, where `<name>` is the last segment of `<path>`.
/// With `-o -`, the entry streams to stdout as one blob and takes no
/// bundle-only flag.
///
/// A `?ns=<id>` in the URI is the namespace routing hint (ADR 002) for every
/// request of the run: the manifest blob and each entry. The bundle-only flags
/// are an error on a blob URI, and the entry filters (`--include`,
/// `--exclude`, `--select`) are an error on an entry URI.