reliadl 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- reliadl-0.1.0/LICENSE +190 -0
- reliadl-0.1.0/PKG-INFO +371 -0
- reliadl-0.1.0/README.md +341 -0
- reliadl-0.1.0/pyproject.toml +43 -0
- reliadl-0.1.0/reliadl.egg-info/PKG-INFO +371 -0
- reliadl-0.1.0/reliadl.egg-info/SOURCES.txt +32 -0
- reliadl-0.1.0/reliadl.egg-info/dependency_links.txt +1 -0
- reliadl-0.1.0/reliadl.egg-info/requires.txt +5 -0
- reliadl-0.1.0/reliadl.egg-info/top_level.txt +1 -0
- reliadl-0.1.0/setup.cfg +4 -0
- reliadl-0.1.0/src/__init__.py +260 -0
- reliadl-0.1.0/src/adapters/__init__.py +103 -0
- reliadl-0.1.0/src/adapters/azure_adapter.py +543 -0
- reliadl-0.1.0/src/adapters/base.py +209 -0
- reliadl-0.1.0/src/adapters/gcs_adapter.py +481 -0
- reliadl-0.1.0/src/adapters/proxy_adapter.py +794 -0
- reliadl-0.1.0/src/adapters/s3_adapter.py +824 -0
- reliadl-0.1.0/src/algorithms/__init__.py +149 -0
- reliadl-0.1.0/src/algorithms/adaptive_chunker.py +510 -0
- reliadl-0.1.0/src/algorithms/metrics_collector.py +459 -0
- reliadl-0.1.0/src/algorithms/mirror_bandit.py +1836 -0
- reliadl-0.1.0/src/algorithms/task_deque.py +355 -0
- reliadl-0.1.0/src/algorithms/work_stealer.py +999 -0
- reliadl-0.1.0/src/config.py +383 -0
- reliadl-0.1.0/src/exceptions.py +583 -0
- reliadl-0.1.0/src/file_assembler.py +198 -0
- reliadl-0.1.0/src/hash_verifier.py +304 -0
- reliadl-0.1.0/src/logger.py +183 -0
- reliadl-0.1.0/src/manifest.py +1160 -0
- reliadl-0.1.0/src/models.py +715 -0
- reliadl-0.1.0/src/rate_limiter.py +433 -0
- reliadl-0.1.0/src/sparse_writer.py +599 -0
- reliadl-0.1.0/src/state_manager.py +317 -0
- reliadl-0.1.0/tests/test_changelog.py +77 -0
reliadl-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the acting entity and all other entities
|
|
16
|
+
that control, are controlled by, or are under common control with
|
|
17
|
+
that entity. For the purposes of this definition, "control" means
|
|
18
|
+
(i) the power, direct or indirect, to cause the direction or
|
|
19
|
+
management of such entity, whether by contract or otherwise, or
|
|
20
|
+
(ii) ownership of fifty percent (50%) or more of the outstanding
|
|
21
|
+
shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 PxA-Labs
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
reliadl-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: reliadl
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Production-grade, fault-tolerant parallel file downloader with per-chunk SHA-256 cryptographic verification.
|
|
5
|
+
Author-email: PxA-Labs <maintainers@pxalabs.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/PxA-Labs/ReliaDL
|
|
8
|
+
Project-URL: Documentation, https://github.com/PxA-Labs/ReliaDL#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/PxA-Labs/ReliaDL.git
|
|
10
|
+
Project-URL: Issues, https://github.com/PxA-Labs/ReliaDL/issues
|
|
11
|
+
Project-URL: Discussions, https://github.com/PxA-Labs/ReliaDL/discussions
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Topic :: System :: Networking
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: pydantic>=2.13.5
|
|
25
|
+
Requires-Dist: PyYAML>=6.0.3
|
|
26
|
+
Requires-Dist: structlog>=26.1.0
|
|
27
|
+
Requires-Dist: jsonschema>=4.26.0
|
|
28
|
+
Requires-Dist: cryptography>=50.0.1
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# ReliaDL: Adaptive Fault-Tolerant Chunked Transfer with Homomorphic Verification and Stochastic Scheduling
|
|
32
|
+
|
|
33
|
+
[](LICENSE)
|
|
34
|
+
[](https://securityscorecards.dev/viewer/?url=github.com/PxA-Labs/ReliaDL)
|
|
35
|
+
[](https://bestpractices.coreinfrastructure.org/projects/github.com/PxA-Labs/ReliaDL)
|
|
36
|
+
[]()
|
|
37
|
+
[]()
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Research Paper Reference
|
|
42
|
+
|
|
43
|
+
> **Paper Title**: ReliaDL: Adaptive Fault-Tolerant Chunked Transfer with Homomorphic Verification and Stochastic Scheduling
|
|
44
|
+
> **Authors**: Purvansh Joshi, Archit Mittal (PxA Labs), Aviral Mittal
|
|
45
|
+
> **Category**: Networked Systems, Transport Protocols, Distributed Systems Reliability
|
|
46
|
+
> **Primary Specification**: [docs/NOVEL_ALGORITHMS.md](docs/NOVEL_ALGORITHMS.md)
|
|
47
|
+
> **Empirical Benchmarks & Methodology**: [docs/PERFORMANCE.md](docs/PERFORMANCE.md)
|
|
48
|
+
|
|
49
|
+
```bibtex
|
|
50
|
+
@article{reliadl2026,
|
|
51
|
+
title={{ReliaDL: Adaptive Fault-Tolerant Chunked Transfer with Homomorphic Verification and Stochastic Scheduling}},
|
|
52
|
+
author={Joshi, Purvansh and Mittal, Archit},
|
|
53
|
+
journal={arXiv preprint arXiv:2608.xxxxx},
|
|
54
|
+
year={2026},
|
|
55
|
+
publisher={PxA Labs},
|
|
56
|
+
url={https://github.com/PxA-Labs/ReliaDL}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Overview
|
|
63
|
+
|
|
64
|
+
**ReliaDL** is a research-oriented, fault-tolerant file transfer framework that formulates the reliable download problem as a constrained stochastic optimization over non-stationary channels. Unlike conventional download managers that employ static chunking and reactive retransmission (ARQ), ReliaDL introduces five novel algorithmic contributions spanning adaptive coding theory, algebraic verification, and optimal resource allocation.
|
|
65
|
+
|
|
66
|
+
The central research question addressed by this work is:
|
|
67
|
+
|
|
68
|
+
> *How can we minimize the expected data retransmission cost while guaranteeing byte-level integrity under non-stationary, bursty channel conditions, subject to throughput and resource constraints?*
|
|
69
|
+
|
|
70
|
+
ReliaDL provides both a theoretical framework with provable performance bounds and a practical Python-based reference implementation suitable for empirical evaluation.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Novel Algorithmic Contributions
|
|
75
|
+
|
|
76
|
+
1. **AdaChunk -- Lyapunov-Based Adaptive Chunk Sizing.** Formulates chunk size selection as an online stochastic optimization problem. Using the Lyapunov drift-plus-penalty framework (Neely, 2010), AdaChunk dynamically adjusts chunk boundaries based on real-time network state observations, achieving an O(1/V) optimality gap with O(V) queue backlog tradeoff.
|
|
77
|
+
|
|
78
|
+
2. **LtHash -- Homomorphic Hash Aggregation.** Employs lattice-based homomorphic hashing to enable O(1) whole-file integrity verification post-assembly without re-reading the file from disk. The homomorphic property H(x || y) = H(x) + H(y) mod p allows algebraic accumulation of per-chunk hashes during download.
|
|
79
|
+
|
|
80
|
+
3. **Sub-Chunk Merkle Localization.** Embeds hierarchical Merkle trees within each chunk at 4 KB segment granularity. Upon detecting a chunk-level hash mismatch, the system localizes corruption to specific 4 KB segments in O(log(B/s)) comparisons, reducing retransmission by up to 99.95%.
|
|
81
|
+
|
|
82
|
+
4. **Predictive Parity Injection.** Implements proactive XOR-based forward error correction (FEC) with injection rate governed by a Gilbert-Elliott two-state Markov channel model estimator. Enables zero-RTT chunk recovery without network round trips under moderate loss conditions.
|
|
83
|
+
|
|
84
|
+
5. **Whittle Index Worker Scheduling.** Models multi-source worker allocation as a restless multi-armed bandit (RMAB) problem. Employs Whittle index policies (Whittle, 1988) for asymptotically optimal stochastic scheduling of download workers across heterogeneous sources.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Key Mathematical Formulations
|
|
89
|
+
|
|
90
|
+
### AdaChunk Optimization Objective
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
min lim_{T->inf} (1/T) * sum_{t=0}^{T-1} E[C(B_t, s_t)]
|
|
94
|
+
s.t. lim_{T->inf} (1/T) * sum_{t=0}^{T-1} E[G(B_t, s_t)] >= G_min
|
|
95
|
+
|
|
96
|
+
Where:
|
|
97
|
+
B_t = chunk size at time t (decision variable)
|
|
98
|
+
s_t = (RTT_t, sigma_RTT, p_t, G_t, BDP_t) (network state)
|
|
99
|
+
C(B, s) = B * (1 - (1-p)^{B/MSS}) (retransmission cost)
|
|
100
|
+
G(B, s) = B*(1-p_retry) / (T_dl + T_overhead) (goodput)
|
|
101
|
+
Q_{t+1} = max(Q_t - G(B_t, s_t) + G_min, 0) (virtual queue)
|
|
102
|
+
B_t* = argmin V*C(B,s_t) - Q_t*G(B,s_t) (per-slot decision)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### LtHash Homomorphic Aggregation
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
H_file = sum_{i=0}^{k-1} H_LtHash(chunk_i) mod p
|
|
109
|
+
|
|
110
|
+
Where H(x) = A * x mod p, A in Z_p^{n x m}, satisfying:
|
|
111
|
+
H(x || y) = H(x) + H(y) mod p (homomorphic property)
|
|
112
|
+
Collision resistance reduces to SIS hardness
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Whittle Index Policy
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
W_i(s) = inf{ w : V_active(s, w) = V_passive(s, w) }
|
|
119
|
+
|
|
120
|
+
At each slot, activate K arms with highest W_i(s_i(t))
|
|
121
|
+
Achieves asymptotic optimality as N -> infinity (Weber & Weiss, 1990)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## System Architecture & Workflow Diagrams
|
|
127
|
+
|
|
128
|
+
### Layered System Architecture
|
|
129
|
+
|
|
130
|
+
```mermaid
|
|
131
|
+
graph TB
|
|
132
|
+
subgraph ClientLayer["1. Client & Configuration Layer"]
|
|
133
|
+
CLI["CLI Interface (main.py)"]
|
|
134
|
+
CONF["Configuration Engine (config.py)"]
|
|
135
|
+
SM["State Manager (state_manager.py - ACID Persistence)"]
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
subgraph ControlLayer["2. Stochastic Control & Optimization Layer"]
|
|
139
|
+
AC["AdaChunk Optimizer<br/>(Lyapunov Drift-Plus-Penalty)"]
|
|
140
|
+
WS["Whittle Scheduler<br/>(Restless Bandit Allocation)"]
|
|
141
|
+
PE["Predictive Parity Encoder<br/>(Gilbert-Elliott Markov FEC)"]
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
subgraph TransportLayer["3. Concurrent Transport Engine"]
|
|
145
|
+
DE["Download Engine (download_engine.py)"]
|
|
146
|
+
W1["Worker 1 (HTTP/2 Range GET)"]
|
|
147
|
+
W2["Worker 2 (HTTP/2 Range GET)"]
|
|
148
|
+
WN["Worker K (HTTP/2 Range GET)"]
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
subgraph VerificationLayer["4. Verification & Localization Layer"]
|
|
152
|
+
DH["Dual Hasher<br/>(Streaming SHA-256 + LtHash)"]
|
|
153
|
+
ML["Sub-Chunk Merkle Localizer<br/>(4 KB Segment Binary Search)"]
|
|
154
|
+
HH["Homomorphic Aggregator<br/>(O(1) Whole-File Integrity Gate)"]
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
subgraph StorageLayer["5. Direct Zero-Copy Storage Engine"]
|
|
158
|
+
FA["Positional Disk Writer (os.pwrite)"]
|
|
159
|
+
OUT["Target Payload Artifact"]
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
CLI --> CONF
|
|
163
|
+
CLI --> DE
|
|
164
|
+
DE <--> SM
|
|
165
|
+
DE --> AC
|
|
166
|
+
DE --> WS
|
|
167
|
+
AC -. "Optimal Chunk Size B_t*" .-> DE
|
|
168
|
+
WS -. "Top-K Arm Assignments" .-> DE
|
|
169
|
+
DE --> PE
|
|
170
|
+
PE -. "Parity Allocation" .-> DE
|
|
171
|
+
DE --> W1 & W2 & WN
|
|
172
|
+
W1 & W2 & WN --> DH
|
|
173
|
+
DH --> ML
|
|
174
|
+
ML --> HH
|
|
175
|
+
DH --> FA
|
|
176
|
+
FA --> OUT
|
|
177
|
+
HH -. "O(1) Verification Pass" .-> SM
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### End-to-End Download & Recovery Sequence
|
|
181
|
+
|
|
182
|
+
```mermaid
|
|
183
|
+
sequenceDiagram
|
|
184
|
+
autonumber
|
|
185
|
+
participant U as User / CLI
|
|
186
|
+
participant DE as Download Engine
|
|
187
|
+
participant AC as AdaChunk Optimizer
|
|
188
|
+
participant WS as Whittle Scheduler
|
|
189
|
+
participant W as Worker Pool
|
|
190
|
+
participant PE as Parity Engine
|
|
191
|
+
participant ML as Merkle Localizer
|
|
192
|
+
participant HH as LtHash Aggregator
|
|
193
|
+
|
|
194
|
+
U->>DE: Initiate Download(URL, Target)
|
|
195
|
+
DE->>AC: Sample Channel State (RTT, Loss, BDP)
|
|
196
|
+
AC-->>DE: Return Optimal Chunk Size B_t*
|
|
197
|
+
DE->>WS: Query Active Arm Rankings
|
|
198
|
+
WS-->>DE: Allocate Top-K Sources
|
|
199
|
+
DE->>PE: Compute Parity Redundancy r*(t)
|
|
200
|
+
PE-->>DE: Attach Proactive FEC Units
|
|
201
|
+
DE->>W: Dispatch Range GET [Start, End]
|
|
202
|
+
W-->>DE: Ingest Chunks + Stream Hashes
|
|
203
|
+
DE->>HH: Accumulate Homomorphic Hash H(chunk)
|
|
204
|
+
alt Chunk Hash Valid
|
|
205
|
+
DE->>DE: Commit to Disk via os.pwrite()
|
|
206
|
+
else Chunk Hash Corrupt
|
|
207
|
+
DE->>ML: Traverse Hierarchical Merkle Tree
|
|
208
|
+
ML-->>DE: Pinpoint Corrupted 4 KB Sub-Blocks
|
|
209
|
+
alt Parity Recoverable
|
|
210
|
+
DE->>PE: Execute Zero-RTT XOR Reconstruction
|
|
211
|
+
PE-->>DE: Reconstructed Valid Sub-Blocks
|
|
212
|
+
else Parity Exhausted
|
|
213
|
+
DE->>W: Issue Targeted 4 KB Range GET
|
|
214
|
+
W-->>DE: Recovered Byte Segment
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
DE->>HH: Evaluate Sum(H_i) == ExpectedRoot mod p
|
|
218
|
+
HH-->>U: Instantaneous O(1) Verification Complete
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Chunk Lifecycle State Machine
|
|
222
|
+
|
|
223
|
+
```mermaid
|
|
224
|
+
stateDiagram-v2
|
|
225
|
+
[*] --> PENDING: Range Partitioned
|
|
226
|
+
PENDING --> SCHEDULED: Whittle Index Priority
|
|
227
|
+
SCHEDULED --> DOWNLOADING: Worker Assigned
|
|
228
|
+
DOWNLOADING --> STREAM_VERIFYING: Buffer Ingestion Complete
|
|
229
|
+
|
|
230
|
+
STREAM_VERIFYING --> HOMOMORPHIC_ACCUMULATED: SHA-256 & LtHash Pass
|
|
231
|
+
HOMOMORPHIC_ACCUMULATED --> COMMITTED: Written via os.pwrite()
|
|
232
|
+
COMMITTED --> [*]
|
|
233
|
+
|
|
234
|
+
STREAM_VERIFYING --> MERKLE_LOCALIZING: Checksum Mismatch Detected
|
|
235
|
+
MERKLE_LOCALIZING --> PARITY_RECOVERY: 4 KB Corrupted Segments Identified
|
|
236
|
+
|
|
237
|
+
PARITY_RECOVERY --> HOMOMORPHIC_ACCUMULATED: Zero-RTT XOR Recovery Pass
|
|
238
|
+
PARITY_RECOVERY --> TARGETED_RETRY: FEC Overhead Insufficient
|
|
239
|
+
TARGETED_RETRY --> DOWNLOADING: Re-request 4 KB Sub-Range
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Repository Structure
|
|
245
|
+
|
|
246
|
+
```
|
|
247
|
+
ReliaDL/
|
|
248
|
+
├── README.md # Project documentation entry point
|
|
249
|
+
├── LICENSE # Apache 2.0 License
|
|
250
|
+
│
|
|
251
|
+
├── docs/
|
|
252
|
+
│ ├── NOVEL_ALGORITHMS.md # Formal mathematical formulations & proofs
|
|
253
|
+
│ ├── PROJECT_OVERVIEW.md # High-level system overview
|
|
254
|
+
│ ├── ARCHITECTURE.md # Component design & architectural decisions
|
|
255
|
+
│ ├── TECHNICAL_SPECIFICATION.md # Detailed protocols, data schemas, & algorithms
|
|
256
|
+
│ ├── API_REFERENCE.md # Complete Python & CLI API specification
|
|
257
|
+
│ ├── DATA_FLOW.md # State machine diagrams & data path sequences
|
|
258
|
+
│ ├── ERROR_HANDLING.md # Error taxonomy & recovery strategies
|
|
259
|
+
│ ├── SECURITY.md # Security analysis & threat model
|
|
260
|
+
│ ├── MANIFEST_SPECIFICATION.md # Chunk manifest (.cgmanifest) & Merkle tree spec
|
|
261
|
+
│ ├── CLOUD_ADAPTERS.md # AWS S3, GCS, Azure Blob, & proxy protocol adapters
|
|
262
|
+
│ ├── OBSERVABILITY.md # Prometheus metrics, OpenTelemetry, & logging
|
|
263
|
+
│ ├── DEPLOYMENT_GUIDE.md # Installation, configuration, & operations
|
|
264
|
+
│ ├── USER_GUIDE.md # Comprehensive end-user guide
|
|
265
|
+
│ ├── TESTING_STRATEGY.md # Test plans, benchmarks, & coverage targets
|
|
266
|
+
│ ├── PERFORMANCE.md # Benchmarks, memory profile, & tuning
|
|
267
|
+
│ ├── CONTRIBUTING.md # Developer contribution standards
|
|
268
|
+
│ ├── CHANGELOG.md # Version history
|
|
269
|
+
│ ├── GLOSSARY.md # Terminology index
|
|
270
|
+
│ ├── FAQ.md # Frequently asked questions
|
|
271
|
+
│ └── agents.md # AI agents & Mem0 memory configuration
|
|
272
|
+
│
|
|
273
|
+
├── src/ # System implementation
|
|
274
|
+
│ ├── chunk_manager.py # Chunk partitioning & boundary logic
|
|
275
|
+
│ ├── download_engine.py # Asynchronous download orchestrator
|
|
276
|
+
│ ├── hash_verifier.py # Streaming SHA-256 verification
|
|
277
|
+
│ ├── state_manager.py # Atomic state file manager
|
|
278
|
+
│ ├── retry_handler.py # Exponential backoff & retry policies
|
|
279
|
+
│ ├── file_assembler.py # Chunk reassembly & final integrity check
|
|
280
|
+
│ ├── config.py # System configuration parser
|
|
281
|
+
│ ├── models.py # Data models & schemas
|
|
282
|
+
│ ├── exceptions.py # Custom exception definitions
|
|
283
|
+
│ ├── logger.py # Structured JSON logging engine
|
|
284
|
+
│ └── main.py # Command Line Interface (CLI) entry point
|
|
285
|
+
│
|
|
286
|
+
├── tests/ # Test suite
|
|
287
|
+
│ ├── unit/ # Unit test modules
|
|
288
|
+
│ ├── integration/ # Integration test modules
|
|
289
|
+
│ └── fixtures/ # Mock data & server fixtures
|
|
290
|
+
│
|
|
291
|
+
└── config/
|
|
292
|
+
└── default_config.yaml # Default system configuration template
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Quick Start
|
|
298
|
+
|
|
299
|
+
### Installation
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
git clone https://github.com/PxA-Labs/ReliaDL.git
|
|
303
|
+
cd ReliaDL
|
|
304
|
+
pip install -r requirements.txt
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Usage
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
# Execute a download with adaptive chunking and homomorphic verification
|
|
311
|
+
python -m src.main download \
|
|
312
|
+
--url "https://example.com/dataset.tar.gz" \
|
|
313
|
+
--output "./downloads/dataset.tar.gz" \
|
|
314
|
+
--adachunk \
|
|
315
|
+
--whittle
|
|
316
|
+
|
|
317
|
+
# Resume an interrupted transfer
|
|
318
|
+
python -m src.main resume \
|
|
319
|
+
--state-file "./downloads/.reliadl/dataset.tar.gz.state"
|
|
320
|
+
|
|
321
|
+
# Verify file integrity
|
|
322
|
+
python -m src.main verify \
|
|
323
|
+
--file "./downloads/dataset.tar.gz" \
|
|
324
|
+
--expected-hash "sha256:abcdef1234567890..."
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## Documentation Index
|
|
330
|
+
|
|
331
|
+
| Document | Audience | Description |
|
|
332
|
+
|---|---|---|
|
|
333
|
+
| [Novel Algorithms](docs/NOVEL_ALGORITHMS.md) | Systems Researchers & Algorithm Engineers | Mathematical formulations, Lyapunov optimization, LtHash, & proofs |
|
|
334
|
+
| [Project Overview](docs/PROJECT_OVERVIEW.md) | Technical & Non-Technical | Business context, problem statement, and scope |
|
|
335
|
+
| [Architecture](docs/ARCHITECTURE.md) | System Architects & Engineers | Structural design, component responsibilities, and trade-offs |
|
|
336
|
+
| [Technical Specification](docs/TECHNICAL_SPECIFICATION.md) | Software Engineers | In-depth protocols, schemas, and mathematical specifications |
|
|
337
|
+
| [API Reference](docs/API_REFERENCE.md) | Integration Developers | Full documentation of Python SDK and CLI commands |
|
|
338
|
+
| [Data Flow](docs/DATA_FLOW.md) | Core Maintainers | State transition models and execution sequence diagrams |
|
|
339
|
+
| [Error Handling](docs/ERROR_HANDLING.md) | Systems & Reliability Engineers | Comprehensive exception taxonomy and fault escalation rules |
|
|
340
|
+
| [Security](docs/SECURITY.md) | Security Analysts & Auditors | Threat model, cryptographic assurances, and mitigations |
|
|
341
|
+
| [Manifest Specification](docs/MANIFEST_SPECIFICATION.md) | Systems Engineers & Auditors | Formal specification of `.cgmanifest`, Merkle trees, and signed catalogs |
|
|
342
|
+
| [Cloud & Protocol Adapters](docs/CLOUD_ADAPTERS.md) | Cloud Architects & DevOps | AWS S3, GCS, Azure Blob, SOCKS5/HTTP proxies, and HTTP/3 QUIC |
|
|
343
|
+
| [Observability & Monitoring](docs/OBSERVABILITY.md) | SREs & Platform Engineers | Prometheus metrics catalog, OpenTelemetry tracing, and Grafana alerting |
|
|
344
|
+
| [Deployment Guide](docs/DEPLOYMENT_GUIDE.md) | DevOps & SREs | Operations, environment setup, and monitoring integration |
|
|
345
|
+
| [User Guide](docs/USER_GUIDE.md) | End Users & Automation Engineers | Detailed command syntax and workflow examples |
|
|
346
|
+
| [Testing Strategy](docs/TESTING_STRATEGY.md) | QA & Test Engineers | Test suite structure, fault injection, and coverage goals |
|
|
347
|
+
| [Performance](docs/PERFORMANCE.md) | Performance Engineers | Benchmarks, memory profile, and tuning strategies |
|
|
348
|
+
| [Contributing](docs/CONTRIBUTING.md) | Contributors | Development setup, code guidelines, and pull request procedures |
|
|
349
|
+
| [AI Agents & Memory](docs/agents.md) | AI Engineers & Agent Developers | Mem0 memory configuration, persistent context, and agent workflows |
|
|
350
|
+
| [Glossary](docs/GLOSSARY.md) | All Readers | Index of technical terms and acronyms |
|
|
351
|
+
| [FAQ](docs/FAQ.md) | All Readers | Answers to common technical and operational questions |
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
## Security & OpenSSF Compliance
|
|
356
|
+
|
|
357
|
+
ReliaDL adheres to the [Open Source Security Foundation (OpenSSF)](https://openssf.org/) Best Practices and Scorecard standards:
|
|
358
|
+
|
|
359
|
+
[](https://securityscorecards.dev/viewer/?url=github.com/PxA-Labs/ReliaDL)
|
|
360
|
+
[](https://bestpractices.coreinfrastructure.org/projects/github.com/PxA-Labs/ReliaDL)
|
|
361
|
+
|
|
362
|
+
* **Cryptographic Verification**: Dual-tier SHA-256 and binary Merkle Tree validation against tampered payloads.
|
|
363
|
+
* **Supply Chain Security**: Pinned GitHub Actions dependencies, strict branch protection rules, and signed manifest catalogs.
|
|
364
|
+
* **Vulnerability Disclosure**: Coordinated security response process documented in [SECURITY.md](docs/SECURITY.md).
|
|
365
|
+
* **Automated CI Gates**: Automated novelty scanning, type checking, and unit test enforcement on all pull requests.
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
## License
|
|
370
|
+
|
|
371
|
+
This project is licensed under the Apache License 2.0. See the [LICENSE](LICENSE) file for the complete terms.
|