Repository navigation
feat(config): expose the frame-memory budget and per-IP cap as settings (#989) #995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
chappie-daemon
wants to merge
14
commits into
factory/016-frame-memory-budget
Choose a base branch
from
factory/017-frame-budget-settings
base: factory/016-frame-memory-budget
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
82ade58
feat(config): expose the frame budget and per-IP cap as settings keys
chappie-daemon 717e4cb
docs(rewrite): record the two bounds as operator settings, and what a…
chappie-daemon 47fc464
test(relay): prove from_settings reads the operator's bounds
chappie-daemon d07f898
fix(relay): cap a setting's bound so an absurd value cannot exhaust u…
chappie-daemon 03180b8
docs(rewrite): say what a bound above the ceiling does, and what the …
chappie-daemon 645a85b
fix(daemon): report a bound setting the relay will replace with its d…
chappie-daemon 99b78a7
docs(rewrite): re-anchor every citation, and name the ceiling where t…
chappie-daemon 593eac8
fix(daemon): tell a zero bound from one above the ceiling, on both re…
chappie-daemon fdc9b22
feat(config): name the cap's unit in its guided label
chappie-daemon 78ef4cf
docs(rewrite): say what the skip does, and re-anchor the citations it…
chappie-daemon 3257f01
fix(relay): derive the refusal from the range check and word it once
chappie-daemon 0679ea1
docs(rewrite): say what a rejected document leaves to report, and re-…
chappie-daemon d3416ba
fix(daemon): never describe a substituted document as a bound violation
chappie-daemon 60aa7e9
docs(rewrite): state the two mechanisms a rejected document leaves, a…
chappie-daemon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| --- | ||
| --- | ||
|
|
||
| feat(config): expose the frame budget and the per-IP cap as settings keys | ||
|
|
||
| The two bounds #959 added were `RelayConfig` fields only: | ||
| "pub frame_memory_budget_bytes: usize," (`crates/nostream-relay/src/relay.rs:66`) and | ||
| "pub max_connections_per_ip: usize," (`crates/nostream-relay/src/relay.rs:70`). A running | ||
| daemon could not change either number without a rebuild, which is what #989 is about. | ||
|
|
||
| Both are now settings the operator writes: | ||
|
|
||
| - `network.frameMemoryBudgetBytes` in `resources/default-settings.yaml` — the byte count every | ||
| socket's queued outbound payload is counted against. | ||
| - `limits.connection.maxConnectionsPerIp` in `resources/default-settings.yaml` — the live | ||
| sockets one source address may hold at once. | ||
|
|
||
| `RelayConfig::from_settings` reads both leaves, in the one place either is interpreted, and falls | ||
| back to the compiled default when a leaf is absent, zero, or above the ceiling that keeps an | ||
| operator's number out of the frame accounting: | ||
| " value > 0 && value <= MAX_SETTING_BOUND as u64" (`crates/nostream-relay/src/relay.rs:115`). The | ||
| daemon builds its config through it: "let mut relay_config = RelayConfig::from_settings(&settings);" | ||
| (`crates/nostreamd/src/main.rs:110`), keeping its one environment read. A value it replaces is not | ||
| silent: the constructor warns with the setting, the value, the ceiling and the default — | ||
| " \"a bound above its ceiling runs with its default\"" (`crates/nostream-relay/src/relay.rs:191`) | ||
| — and `nostreamd --check` and `nostream-cli config validate` print the same sentences before a relay | ||
| exists, from one place: "pub fn refusal_message(setting: &str, reason: BoundRefusal) -> String {" | ||
| (`crates/nostream-relay/src/relay.rs:169`). | ||
|
|
||
| The defaults document's values equal `RelayConfig::default()`'s, and a test in | ||
| `crates/nostream-relay/tests/config_defaults.rs` holds the two together. No validator rule is | ||
| added: the document is the validator's schema, so the two keys alone make an operator's file | ||
| valid. See ADR 0008 for what a zero means and why. | ||
|
|
||
| The TypeScript tree is untouched: no `src/` or `test/` file changes, so the published package | ||
| has no user-visible change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The published TypeScript CLI reads the shared defaults, so it accepts and saves both new keys. But the TypeScript relay never reads either one. Operators can receive a successful update while neither limit takes effect.
Mark both settings as Rust-only here and in the shared defaults comments.
Knowledge Base Used: Configuration, CLI, and deployment