nextcloud-s3-backup 1.0.0__py3-none-any.whl

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.
@@ -0,0 +1,373 @@
1
+ Metadata-Version: 2.5
2
+ Name: nextcloud-s3-backup
3
+ Version: 1.0.0
4
+ Summary: Nextcloud S3 primary storage incremental backup
5
+ Project-URL: Repository, https://github.com/petrus-v/nextcloud-s3-backup
6
+ Project-URL: Bug Tracker, https://github.com/petrus-v/nextcloud-s3-backup/issues
7
+ Project-URL: Changelog, https://github.com/petrus-v/nextcloud-s3-backup/blob/main/CHANGELOG.md
8
+ Author-email: Pierre Verkest <pierreverkest84@gmail.com>
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Classifier: Development Status :: 2 - Pre-Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Natural Language :: English
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Programming Language :: Python :: 3.15
18
+ Classifier: Topic :: Software Development :: Libraries
19
+ Requires-Python: >=3.13
20
+ Requires-Dist: cloudpathlib[s3]>=0.21
21
+ Requires-Dist: psycopg2-binary>=2.9.10
22
+ Requires-Dist: pydantic>=2.10
23
+ Requires-Dist: pyyaml>=6.0
24
+ Description-Content-Type: text/markdown
25
+
26
+ # Nextcloud S3 Backup
27
+
28
+ <p align="center">
29
+ <a href="https://github.com/petrus-v/nextcloud-s3-backup/actions/workflows/ci.yml">
30
+ <img src="https://img.shields.io/github/actions/workflow/status/petrus-v/nextcloud-s3-backup/ci.yml?branch=main&label=CI&logo=github&style=flat-square" alt="CI Status">
31
+ </a>
32
+ <a href="https://codecov.io/gh/petrus-v/nextcloud-s3-backup">
33
+ <img src="https://img.shields.io/codecov/c/github/petrus-v/nextcloud-s3-backup.svg?logo=codecov&logoColor=fff&style=flat-square" alt="Test coverage percentage">
34
+ </a>
35
+ </p>
36
+ <p align="center">
37
+ <a href="https://docs.astral.sh/uv/">
38
+ <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json&style=flat-square" alt="uv">
39
+ </a>
40
+ <a href="https://docs.astral.sh/ruff/">
41
+ <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&style=flat-square" alt="Ruff">
42
+ </a>
43
+ <a href="https://github.com/pre-commit/pre-commit">
44
+ <img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=flat-square" alt="pre-commit">
45
+ </a>
46
+ </p>
47
+ <p align="center">
48
+ <a href="https://pypi.org/project/nextcloud-s3-backup/">
49
+ <img src="https://img.shields.io/pypi/v/nextcloud-s3-backup.svg?logo=python&logoColor=fff&style=flat-square" alt="PyPI Version">
50
+ </a>
51
+ <img src="https://img.shields.io/pypi/pyversions/nextcloud-s3-backup.svg?style=flat-square&logo=python&amp;logoColor=fff" alt="Supported Python versions">
52
+ <img src="https://img.shields.io/pypi/l/nextcloud-s3-backup.svg?style=flat-square" alt="License">
53
+ </p>
54
+
55
+ Nextcloud S3 primary storage incremental backup.
56
+
57
+ This command line utility backup tool is designed to create incremental backup
58
+ from Nextcloud S3 primary storage.
59
+
60
+ When using Nextcloud S3 primary storage, files are stored with oid as reference likes `urn:oid:579`.
61
+
62
+ Backuping those files are not easy to restore particular files.
63
+
64
+ This tool is designed to:
65
+
66
+ - re-create file tree
67
+ - snapshot like
68
+ - multiple storage tree (to manage access write)
69
+
70
+ This tool is not designed for
71
+
72
+ - quick restaure the whole nextcloud
73
+
74
+ ## Installation
75
+
76
+ Requires **Python 3.13+**. Install via [uv](https://docs.astral.sh/uv/) or `pip`:
77
+
78
+ ```bash
79
+ uv tool install nextcloud-s3-backup
80
+ # or
81
+ pip install nextcloud-s3-backup
82
+ ```
83
+
84
+ ## How it works
85
+
86
+ **Data structure**:
87
+
88
+ Once the script has been executed you will get the following tree:
89
+
90
+ ```bash
91
+ .
92
+ ├── BACKUP-NC
93
+ │ ├── .data # Directory hash file, here files are saved by hash (sha1 and/or md5)
94
+ │ │ ├── sha1 # Source of true here files are stored by sha1 computed locally to ensure integrity
95
+ │ │ │ ├── fe # 2 first sha1 character to limit the number of files per directory
96
+ │ │ │ │ ├── e41dea13f... # files are saved with there SHA1 and each day an hard link point on it
97
+ │ │ │ │ ├── e3fc696fe... # this file is duplicated in the tree but saved only once here
98
+ │ │ │ │ └── e3f6d2149... # this files is not use anymore by any snapshot and can be "garbage collected"
99
+ │ │ │ ├── ...
100
+ │ │ │ └── ff
101
+ │ │ ├── etag # Files created/copied/updated/moved through nextcloud
102
+ # haven't any SHA1 nor valid md5 here we save etag hardlink to sha1 files
103
+ # as we can retrieve etag from s3 without download files
104
+ # file that have sha1 filled do not necessarily have md5/etag
105
+ │ │ │ ├── aa # 2 first etag character to limit the number of files per directory.
106
+ │ │ │ │ ├── wxyz...abc-3 # file name is etag from remote and is an hardlink to sha1
107
+ │ │ │ │ ├── ...
108
+ │ │ │ │ └── abce...efg-2 # files not use anymore by any snapshot and can be "garbage collected"
109
+ │ │ │ ├── ...
110
+ │ │ │ └── ff
111
+ │ ├── snapshots # Snapshot directory
112
+ │ │ ├── 2022-11-17 # snapshot date (can be configured from config file)
113
+ │ │ │ ├── user-nc-1 # A string configured in mapping file (can be different from storage user)
114
+ │ │ │ │ ├── REP 1 # Non empty directory
115
+ │ │ │ │ │ └── file2.ia # hard link to fee41dea13f file
116
+ │ │ │ │ ├── file1.ia # hard link to fee3fc696fe file
117
+ │ │ │ │ └──
118
+ │ │ │ ├── ...
119
+ │ │ │ └── user-nc-1
120
+ │ │ │ └── file1.copy.ia # hard link to fee3fc696fe file (file is named differently but content is the same as file1.ia)
121
+ │ │ └── 2021-11-18
122
+ │ │ │ ├── user-nc-1 # A string configured in mapping file (can be different from storage user)
123
+ │ │ │ │ ├── REP 1 # Non empty directory
124
+ │ │ │ │ │ └── file2.ia # hard link to fee41dea13f file
125
+ │ │ │ │ ├── file1.ia # hard link to fee3fc696fe file
126
+ │ │ │ │ └──
127
+ │ │ │ ├── ...
128
+ │ │ │ └── user-nc-1
129
+ │ │ │ └── file1.copy.ia # hard link to fee3fc696fe file (file is named differently but content is the same as file1.ia)
130
+ ```
131
+
132
+ **Requirements**:
133
+
134
+ - First script needs to get access to `[oc_]filecache` table or a backup of it.
135
+ - User should provide a config file to tell what to backup where
136
+ - file system that allow hard link.
137
+
138
+ **Process**:
139
+
140
+ - for each mapping defined in config file
141
+ - for each files matching path and mimetype restrictions
142
+ - if SHA1 present in filecache (file send with nextcloud client)
143
+ - if SHA1 NOT present locally
144
+ - retrieve file from S3 bucket in a temporary file (saved in expected sha1 from filecache table information)
145
+ - compute SHA1 locally
146
+ - rename file to the local sha1 computation
147
+ - if SHA1 not defined (file created, updated, moved or copy from web interface)
148
+ - retrieve etag information from s3 file
149
+ - if remote etag not present locally
150
+ - retrieve file from S3 bucket in a temporary file (saved in expected etag from s3 bucket)
151
+ - compute SHA1 locally
152
+ - if local sha1 present
153
+ - remove downloaded file
154
+ - elif local sha1 not present
155
+ - rename file to the local sha1 computation
156
+ - create hard link with etag to sha1 file
157
+ - else get referred sha1
158
+ - create hard link in the current snapshot directory to the sha1 file
159
+
160
+ > **Note**: ETag are not md5, in case of multipart upload etag is the md5 of all
161
+ > md5 parts + "-" + number of upload parts. Here we laverage the risk of integrity data
162
+ > by moving file after download is completed. This avoid to make a différences between
163
+ > multi part uploads files and one part upload (where we could check the md5 integrity
164
+ > but we won't it would be the donwlonding boto3 role).
165
+
166
+ ## Usage
167
+
168
+ ### Backup
169
+
170
+ Backup nextcloud data
171
+
172
+ ```bash
173
+ nextcloud-s3-backup -h
174
+ usage: nextcloud-s3-backup [-h] [-f LOGGING_FILE] [-l LOGGING_LEVEL] [--logging-format LOGGING_FORMAT] [--s3-endpoint-url S3_ENDPOINT_URL] [--s3-region-name S3_REGION_NAME] [--s3-access-key S3_ACCESS_KEY_ID]
175
+ [--s3-secret-key S3_SECRET_ACCESS_KEY] [--s3-multipart-threshold S3_MULTIPART_THRESHOLD_MB] [--s3-multipart-chunksize S3_MULTIPART_CHUNKSIZE_MB] [--s3-no-threads]
176
+ [--s3-max-bandwidth S3_MAX_BANDWIDTH_MB] [--s3-max-concurrency S3_MAX_CONCURRENCY] [--s3-num-download-attempts S3_NUM_DOWNLOAD_ATTEMPTS] [--s3-max-io-queue S3_MAX_IO_QUEUE_MB]
177
+ [--s3-io-chunksize S3_IO_CHUNKSIZE_MB] [--s3-progress] [--pg-dsn PG_DSN] [--pg-schema PG_SCHEMA]
178
+ config
179
+
180
+ Nextcloud S3 backup
181
+
182
+ positional arguments:
183
+ config Nextcloud S3 backup config file is a json/yaml file that contains mapping of directories to backup.
184
+
185
+ optional arguments:
186
+ -h, --help show this help message and exit
187
+
188
+ Logging params:
189
+ -f LOGGING_FILE, --logging-file LOGGING_FILE
190
+ Logging configuration file, (logging-level and logging-format are ignored if provide) (default: None)
191
+ -l LOGGING_LEVEL, --logging-level LOGGING_LEVEL
192
+ --logging-format LOGGING_FORMAT
193
+
194
+ S3 configuration:
195
+ --s3-endpoint-url S3_ENDPOINT_URL
196
+ S3 endpoint url (default: https://s3.fr-par.scw.cloud)
197
+ --s3-region-name S3_REGION_NAME
198
+ S3 region name. (default: fr-par)
199
+ --s3-access-key S3_ACCESS_KEY_ID
200
+ S3 access key ID. (default: None)
201
+ --s3-secret-key S3_SECRET_ACCESS_KEY
202
+ S3 secret key. (default: None)
203
+
204
+ S3 Transfer configuration:
205
+ --s3-multipart-threshold S3_MULTIPART_THRESHOLD_MB
206
+ The transfer size threshold for which multipart uploads, downloads, and copies will automatically be triggered.. (MB) (default: 120)
207
+ --s3-multipart-chunksize S3_MULTIPART_CHUNKSIZE_MB
208
+ The partition size of each part for a multipart transfer. (MB) (default: 100)
209
+ --s3-no-threads If False, threads will be used when performing S3 transfers. If True, no threads will be used in performing transfers; all logic will be run in the main thread. (default: False)
210
+ --s3-max-bandwidth S3_MAX_BANDWIDTH_MB
211
+ The maximum bandwidth that will be consumed in uploading and downloading file content. The value is an integer in terms of Mega bytes per second. (MB) (default: None)
212
+ --s3-max-concurrency S3_MAX_CONCURRENCY
213
+ The maximum number of threads that will be making requests to perform a transfer. If ``use_threads`` is set to ``False``, the value provided is ignored as the transfer will only ever
214
+ use the main thread. (10) (default: 10)
215
+ --s3-num-download-attempts S3_NUM_DOWNLOAD_ATTEMPTS
216
+ The number of download attempts that will be retried upon errors with downloading an object in S3. Note that these retries account for errors that occur when streaming down the data
217
+ from s3 (i.e. socket errors and read timeouts that occur after receiving an OK response from s3). Other retryable exceptions such as throttling errors and 5xx errors are already retried
218
+ by botocore (this default is 5). This does not take into account the number of exceptions retried by botocore. (default: 5)
219
+ --s3-max-io-queue S3_MAX_IO_QUEUE_MB
220
+ The maximum amount of read parts that can be queued in memory to be written for a download. The size of each of these read parts is at most the size of ``io_chunksize``. (MB) (default:
221
+ 100)
222
+ --s3-io-chunksize S3_IO_CHUNKSIZE_MB
223
+ The max size of each chunk in the io queue. Currently, this is size used when ``read`` is called on the downloaded stream as well. (MB) (default: 1)
224
+ --s3-progress Display upload/downloads progress in stdout. To be use with --mt-thread-size=1 not properly working otherwise (default: False)
225
+
226
+ Postgresql connection:
227
+ --pg-dsn PG_DSN Postgresql connection string (default: postgresql:///nc-backup?application_name=nextcloud-s3-backup)
228
+ --pg-schema PG_SCHEMA
229
+ Postgresql default schema (default: public)
230
+ ```
231
+
232
+ ### Purge .data/ directory
233
+
234
+ This script is about removing .data/[sha1|etag] files to give freespace by
235
+ removing files that are not present in snapshot directory.
236
+
237
+ This script assume you have already remove old/unwanted snapshots
238
+ otherwise we don't expect to remove any files.
239
+
240
+ ```bash
241
+ nextcloud-s3-backup-purge -h
242
+ usage: nextcloud-s3-backup-purge [-h] [-f LOGGING_FILE] [-l LOGGING_LEVEL] [--logging-format LOGGING_FORMAT] config
243
+
244
+ Nextcloud S3 backup purge Use with caution! This script loop over uniques backup_root_path present in your config file to remove files present in the .data that are not present in the snapshots dicectory
245
+
246
+ positional arguments:
247
+ config Nextcloud S3 backup config file is a json/yaml file that contains mapping of directories to backup.
248
+
249
+ optional arguments:
250
+ -h, --help show this help message and exit
251
+
252
+ Logging params:
253
+ -f LOGGING_FILE, --logging-file LOGGING_FILE
254
+ Logging configuration file, (logging-level and logging-format are ignored if provide) (default: None)
255
+ -l LOGGING_LEVEL, --logging-level LOGGING_LEVEL
256
+ --logging-format LOGGING_FORMAT
257
+ ```
258
+
259
+ ### Prepare config file
260
+
261
+ This script help to write/edit the config file
262
+
263
+ ```
264
+ nextcloud-s3-backup-config -h
265
+ usage: nextcloud-s3-backup-config [-h] [--storage-id STORAGE_ID] [--user-name USER_NAME] [--bucket BUCKET] [--nextcloud-path NEXTCLOUD_PATH] [--backup-root-path BACKUP_ROOT_PATH] {json,yaml} config
266
+
267
+ Helper to validate/convert NextCloudS3Configand add entry. Do not change current files, display result in output.
268
+
269
+ positional arguments:
270
+ {json,yaml} choose output format
271
+ config Nextcloud S3 backup config file is a json/yaml file that contains mapping of directories to backup.
272
+
273
+ optional arguments:
274
+ -h, --help show this help message and exit
275
+
276
+ Optional add mapping:
277
+ --storage-id STORAGE_ID
278
+ Nextcloud storage id (`storage`), used to query oc_filecache table (default: None)
279
+ --user-name USER_NAME
280
+ User name used to create directory root tree and make config file easier to read. This value can differ from nextcloud database information (default: None)
281
+ --bucket BUCKET S3 bucket uri. the root directory where are stored Nextcloud user storage. ie: s3://com.example.nextcloud/ (default: None)
282
+ --nextcloud-path NEXTCLOUD_PATH
283
+ Root path to archive for given storage user as seen in nextcloud (default: None)
284
+ --backup-root-path BACKUP_ROOT_PATH
285
+ Root path where to backup files (default: None)
286
+
287
+ ```
288
+
289
+ Following extra params exist on top of the config file
290
+
291
+ - **backup_date_format**: Snapshot date format directory name (ie: `"%y%m"`), default: `"%y%m%d-%H%M"`
292
+ - **excluded_mimetype_ids**: List of mimetypes to exclude while retrieving
293
+ files to backup from nextcloud SQL table (ie: [15, 84]). **You must at least exclude directory**.
294
+
295
+ > **Note** in my config file I'm using `excluded_mimetype_ids: [2]` where
296
+ >
297
+ > ```sql
298
+ > # select * from oc_mimetypes where id = 2;
299
+ > id | mimetype
300
+ > ----+----------------------
301
+ > 2 | httpd/unix-directory
302
+ > (1 row)
303
+ > ```
304
+
305
+ - **allowed_ignored_errors**: Number of errors allowed to ignores while backuping and do not interrupt
306
+ on the first error (default: `0`). If you allow some errors, in any case if there is one
307
+ exception while backup-ing a file the program will exit with error code 99.
308
+
309
+ The two following params are a bit experimental and hacky, I don't know why my S3 provider
310
+ sometimes return a 404 while getting headobject method to retrieve S3 Etag information.
311
+ Boto3 doesn't seem to apply retry rules on that uri, so we implement one:
312
+
313
+ - **s3_head_object_retries**: number retries allowed (default: `10`)
314
+ - **s3_head_object_interval_s**: time to wait between two tries (default: `3.0` second)
315
+
316
+ ## Releasing
317
+
318
+ Releases are created locally using [`bump-my-version`](https://callowayproject.github.io/bump-my-version/) and published to PyPI automatically via GitHub Actions ([PyPI Trusted Publishing](https://docs.pypi.org/trusted-publishers/)) when a version tag (`v*`) is pushed and all CI checks (`lint`, `commitlint`, `test`) pass.
319
+
320
+ 1. Ensure `main` is up to date and tests pass:
321
+
322
+ ```bash
323
+ uv run pytest
324
+ ```
325
+
326
+ 2. Preview the version bump (`patch`, `minor`, or `major`):
327
+
328
+ ```bash
329
+ uvx bump-my-version bump minor --dry-run --verbose
330
+ ```
331
+
332
+ 3. Run the release bump. This updates `pyproject.toml`, `src/nc_s3_backup/__init__.py`, refreshes `uv.lock`, prepends the unreleased commits to `CHANGELOG.md` via `git-cliff`, creates the release commit, and tags it as `vX.Y.Z`:
333
+
334
+ ```bash
335
+ uvx bump-my-version bump minor
336
+ ```
337
+
338
+ 4. Push the commit and tag to trigger the PyPI & GitHub release workflow:
339
+
340
+ ```bash
341
+ git push origin main --follow-tags
342
+ ```
343
+
344
+ ## Contributors ✨
345
+
346
+ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
347
+
348
+ <!-- prettier-ignore-start -->
349
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
350
+ <!-- prettier-ignore-start -->
351
+ <!-- markdownlint-disable -->
352
+ <table>
353
+ <tbody>
354
+ <tr>
355
+ <td align="center" valign="top" width="14.28%"><a href="http://pierre.verkest.fr/"><img src="https://avatars.githubusercontent.com/u/4328507?v=4?s=80" width="80px;" alt="Pierre Verkest"/><br /><sub><b>Pierre Verkest</b></sub></a><br /><a href="https://github.com/petrus-v/nextcloud-s3-backup/commits?author=petrus-v" title="Code">💻</a> <a href="#ideas-petrus-v" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/petrus-v/nextcloud-s3-backup/commits?author=petrus-v" title="Documentation">📖</a></td>
356
+ </tr>
357
+ </tbody>
358
+ </table>
359
+
360
+ <!-- markdownlint-restore -->
361
+ <!-- prettier-ignore-end -->
362
+
363
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
364
+ <!-- prettier-ignore-end -->
365
+
366
+ This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
367
+
368
+ ## Credits
369
+
370
+ This package was created with
371
+ [Copier](https://copier.readthedocs.io/) and the
372
+ [browniebroke/pypackage-template](https://github.com/browniebroke/pypackage-template)
373
+ project template.
@@ -0,0 +1,12 @@
1
+ nc_s3_backup/__init__.py,sha256=J-j-u0itpEFT6irdmWmixQqYMadNl1X91TxUmoiLHMI,22
2
+ nc_s3_backup/cli.py,sha256=o45OTWjmPhwkTmkg6TL1t7Zy4h7frF2bloRIrNdCzls,13079
3
+ nc_s3_backup/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ nc_s3_backup/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ nc_s3_backup/api/backup.py,sha256=g4_8nZ-DZC_vJCCbdxJCYAU-GEgaCkWZHPYx-LaZNiE,15790
6
+ nc_s3_backup/api/config.py,sha256=xuWRuA77OzN_5q645uWFrbTl3OMycQ3YLb8WZcKYYig,1636
7
+ nc_s3_backup/api/db.py,sha256=hUWzyW2zNKDMzp6zGAuCK6msZdPrpHTumHKLFEANBY4,4456
8
+ nextcloud_s3_backup-1.0.0.dist-info/METADATA,sha256=d8Ff1kc9KWd_a-qF1NTa82S0t29gcveQmIxYEXf-qB8,19021
9
+ nextcloud_s3_backup-1.0.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
10
+ nextcloud_s3_backup-1.0.0.dist-info/entry_points.txt,sha256=DoSt14yTLjiEaj1A7ptwZ5uKPwwcZvl6rcn6eqC-XNs,173
11
+ nextcloud_s3_backup-1.0.0.dist-info/licenses/LICENSE,sha256=VHcF3X3YUTyb5Rn31tHp8d0mMAOaxOzkA96unNcInCs,11345
12
+ nextcloud_s3_backup-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,4 @@
1
+ [console_scripts]
2
+ nextcloud-s3-backup = nc_s3_backup.cli:main
3
+ nextcloud-s3-backup-config = nc_s3_backup.cli:config_helper
4
+ nextcloud-s3-backup-purge = nc_s3_backup.cli:purge
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2022 Pierre Verkest
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.