| 1 | // SPDX-License-Identifier: Apache-2.0 |
| 2 | // Copyright (c) 2026 UtopiaIA |
| 3 | |
| 4 | //! The sizes of section 12 of `docs/hub.md` that do not depend on rate: |
| 5 | //! what one request may carry or ask for. A request over one of them is |
| 6 | //! answered 413 `too_large`, so a client splits its work to stay under |
| 7 | //! them. |
| 8 | |
| 9 | /// The largest object a `PUT …/o/{id}` takes: 64 MiB. Larger objects go |
| 10 | /// through the object stream. |
| 11 | pub const MAX_PUT: u64 = 64 << 20; |
| 12 | |
| 13 | /// The largest request body, which only an object stream reaches: 256 MiB. |
| 14 | /// It bounds each record of the stream too. |
| 15 | pub const MAX_BODY: u64 = 256 << 20; |
| 16 | |
| 17 | /// The largest JSON request body: 4 MiB. |
| 18 | pub const MAX_JSON: usize = 4 << 20; |
| 19 | |
| 20 | /// The most ids one list of a request holds: `lacks`, `want` and `have` of |
| 21 | /// `missing`, and the stack of a landing. |
| 22 | pub const MAX_IDS: usize = 10_000; |
| 23 | |
| 24 | /// The most path prefixes one `missing` request names. |
| 25 | pub const MAX_PATHS: usize = 1_000; |
| 26 | |
| 27 | /// Entries in a page of `missing` when the request gives no `limit`. |
| 28 | pub const MISSING_PAGE: usize = 10_000; |
| 29 | |
| 30 | /// The most entries in a page of `missing`: a larger `limit` gives pages of |
| 31 | /// this size. |
| 32 | pub const MISSING_PAGE_MAX: usize = 100_000; |
| 33 | |
| 34 | /// The most objects one `missing` walk lists, over all its pages, or in its |
| 35 | /// object stream. A larger walk is refused: ask for less history, for fewer |
| 36 | /// paths, or give what you hold in `have`. |
| 37 | pub const MISSING_OBJECTS: usize = 1_000_000; |
| 38 | |
| 39 | /// The most entries of one tree listing (`GET …/t/{tree}`). |
| 40 | pub const TREE_ENTRIES: usize = 100_000; |
| 41 | |
| 42 | /// The deepest tree listing: the most levels `depth` asks for. |
| 43 | pub const TREE_DEPTH: u32 = 64; |
| 44 | |
| 45 | /// The most items of the other lists: an account's repositories and |
| 46 | /// tokens, and a repository's collaborators. |
| 47 | pub const MAX_LIST: usize = 1_000; |