aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-memquota/src/config.rs
Commit message (Collapse)AuthorAgeFilesLines
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* config: Add a method to fill in a builder with unset defaultsNick Mathewson2026-05-271-0/+16
| | | | | | | | | | | | | | | This new method modifies a builder by replacing any unset values that have a default with that default. We're using this method so that we can re-serialize a builder into a `ConfigurationTree` with all of its default values included. In all cases, `b.apply_defaults()?; b.build()` should produce the same output as `b.build()`. The interesting parts of this commit are in tor_config::load and tor_config::derive. The rest of this commit just adds `apply_defaults` to other builders that _aren't_ made with `derive_deftly(TorConfig)`.
* memquota: Implement ExtendBuilder for config builder.Nick Mathewson2026-02-241-0/+13
|
* tor-memquota: fix builds for 32-bit platformsYaksh Bariya2025-12-091-4/+10
| | | | | Multiplying 8 * GIB overflows the usize limit (4 GIB - 1) on 32-bit platforms. So handle this properly for 32-bit platforms
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-1/+1
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* tor-memquota: moved auto calc into separate functionSteven Engler2025-07-311-49/+112
|
* tor-memquota: return an error when `total_available_memory()` failsSteven Engler2025-07-311-15/+29
|
* tor-memquota: change behaviour of "auto"Steven Engler2025-07-311-23/+180
| | | | | A `max` of "auto" (the default) now determines a limit based on the system's total available memory, rather than acting as "disabled".
* tor-memquota: config now supports `ExplicitOrAuto`Steven Engler2025-07-311-16/+56
| | | | | Note that this contains a breaking change to the `ConfigBuilder`. This should not break any existing toml configuration files.
* tor-memquota: add config test for `usize::MAX`Steven Engler2025-07-311-0/+4
|
* tor-memquota: Use a const to hoist a panic to compile-timeIan Jackson2024-09-101-1/+3
|
* Fix typo in tor_memquota::ConfigBuilder docIan Jackson2024-09-041-1/+1
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2374#note_3070500
* tor-memquota: Unstable cargo feature for exposing info for testingIan Jackson2024-09-041-2/+16
|
* tor-memquota: Rework optionality configurationIan Jackson2024-09-041-22/+78
| | | | | | | | | | | | | | | | | | Allow a `Config` to represent "this is supposed to be disabled". This involves wrapping the actual built configuration in an IfEnabled. We treat max = usize::MAX, or max being unspecified, as "disable". We can now reporting an error during config building if max is set but we're compiling the feature out. Conversely, we can now make `MemoryQuotaTracker::new()` unconditional, since enabled confiogurations are uninhabited when the feature is compiled out. We change how we derive the setters, deriving them from the Builder. I chose to abolish the use of derive_builder. See the new comment on ConfigBuilder.
* tor-memquota: Add unit tests for config handlingIan Jackson2024-09-041-0/+56
| | | | | We're about to change the config behaviour; adding these tests first allows us to demonstrate the changes.
* Change deftly syntax to post 0.12.1 versionIan Jackson2024-06-171-1/+1
| | | | | | | | | | | * Change `pub` to `export` * Change the `=` in define to `:` * Change `pub_template_semver_check` to `template_export_semver_check` Right now, 0.12.1 supports both syntaxes. I have verified this branch also compiles with https://gitlab.torproject.org/Diziet/rust-derive-deftly/-/merge_requests/402 ee171ffaf56d7dcb7d75584054921153fe19b222
* Rename tor-memtrack to tor-memquotaIan Jackson2024-04-291-0/+103