-
Notifications
You must be signed in to change notification settings - Fork 179
feat: Http2ClientProtocolConfig and GrpcClientProtocolConfig in internal proto #21785
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
derektriley
wants to merge
25
commits into
main
Choose a base branch
from
21777-http2client-config-bns
base: main
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.
+882
−242
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
72816cc
Add Http2ClientProtocolConfig to block-nodes json
derektriley 1499a8e
Add GrpcClientProtocolConfig to block-nodes json
derektriley 876ae4e
unit tests
derektriley 6a2a22d
javadoc
derektriley f8552a9
clear grpc configs
derektriley 34cdc3c
types
derektriley 23d876e
finals
derektriley e8aea24
Merge remote-tracking branch 'remotes/origin/main' into 21777-http2cl…
derektriley 333cc5e
wip maxMessageSizeBytes
derektriley 4082270
unit tests
derektriley 938f016
javadoc
derektriley 53248c9
Merge remote-tracking branch 'remotes/origin/main' into 21777-http2cl…
derektriley d6b6b36
wip
derektriley a60f194
unit tests
derektriley edf6e63
markdown
derektriley 7917bd1
Update Unit Tests and rename
derektriley ccbc71b
Merge remote-tracking branch 'remotes/origin/main' into 21777-http2cl…
derektriley 0d306c3
fix unit test
derektriley 77cc406
Merge remote-tracking branch 'remotes/origin/main' into 21777-http2cl…
derektriley 388f561
Merge remote-tracking branch 'remotes/origin/main' into 21777-http2cl…
derektriley ac9b7c8
updates
derektriley 63d1ddd
chore: updated 21777 with main (#22123)
AlexKehayov f6803a1
Revert "chore: updated 21777 with main (#22123)"
derektriley d73a237
chore: Rebased 21777 on main (#22150)
AlexKehayov 4d393bf
sign
petreze 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| ## Block Nodes JSON configuration | ||
|
|
||
| This document describes the `block-nodes.json` file used to configure which Block Nodes a Consensus Node can connect to, along with optional client protocol settings per node. | ||
|
|
||
| Note: The canonical definition of this structure is the HAPI proto located at `hapi/hapi/src/main/proto/network/block_node_connections.proto`. The `block-nodes.json` file uses the PBJ JSON encoding of that schema. | ||
|
|
||
| The file is read from the directory configured by `blockNode.blockNodeConnectionFileDir` and must be named `block-nodes.json`. | ||
|
|
||
| ### Top-level structure | ||
|
|
||
| The file is a JSON object with a single field: | ||
|
|
||
| - `nodes`: array of Block Node entries | ||
|
|
||
| ### Node entry schema | ||
|
|
||
| Each element of `nodes` has the following fields: | ||
|
|
||
| - `address` (string, required): Hostname or IPv4/IPv6 address of the Block Node (e.g. `"localhost"`, `"10.0.0.5"`). | ||
| - `port` (integer, required): TCP port for the node’s gRPC endpoint. | ||
| - `priority` (integer, required): Lower numbers are higher priority. Nodes with smaller priority values are preferred for selection. Among nodes with the same priority, selection is randomized. | ||
| - `http2ClientProtocolConfig` (object, optional): Overrides for the HTTP/2 client. | ||
| - `name` (string, optional) | ||
| - `ping` (boolean, optional) | ||
| - `pingTimeout` (string, optional): ISO-8601 duration, e.g. `"PT0.5S"` for 500ms. | ||
| - `flowControlBlockTimeout` (string, optional): ISO-8601 duration. | ||
| - `initialWindowSize` (integer, optional) | ||
| - `maxFrameSize` (integer, optional) | ||
| - `maxHeaderListSize` (string, optional): may be `"-1"` to indicate unlimited (as supported by Helidon config). | ||
| - `priorKnowledge` (boolean, optional) | ||
| - `grpcClientProtocolConfig` (object, optional): Overrides for the gRPC protocol. | ||
| - `name` (string, optional) | ||
| - `abortPollTimeExpired` (boolean, optional) | ||
| - `heartbeatPeriod` (string, optional): ISO-8601 duration, e.g. `"PT10S"`. | ||
| - `initBufferSize` (integer, optional) | ||
| - `pollWaitTime` (string, optional): ISO-8601 duration. | ||
| - `maxMessageSizeBytes` (integer, optional): Maximum per-request payload size in bytes for this node. The system enforces an upper cap of 2,097,152 bytes (2 MB) due to PBJ limits; if configured above this, the effective limit will be 2 MB. | ||
|
|
||
| ### Example | ||
|
|
||
| ```json | ||
| { | ||
| "nodes": [ | ||
| { | ||
| "address": "localhost", | ||
| "port": 50051, | ||
| "priority": 0, | ||
| "http2ClientProtocolConfig": { | ||
| "name": "h2", | ||
| "ping": true, | ||
| "pingTimeout": "PT0.5S", | ||
| "flowControlBlockTimeout": "PT1S", | ||
| "initialWindowSize": 12345, | ||
| "maxFrameSize": 16384, | ||
| "maxHeaderListSize": "-1", | ||
| "priorKnowledge": false | ||
| }, | ||
| "grpcClientProtocolConfig": { | ||
| "name": "grpc", | ||
| "abortPollTimeExpired": false, | ||
| "heartbeatPeriod": "PT0S", | ||
| "initBufferSize": 1024, | ||
| "pollWaitTime": "PT10S" | ||
| }, | ||
| "maxMessageSizeBytes": 1500000 | ||
| }, | ||
| { | ||
| "address": "pbj-unit-test-host", | ||
| "port": 8081, | ||
| "priority": 1 | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| ### Selection behavior | ||
|
|
||
| - Nodes are grouped by `priority` and considered from lowest value to highest. | ||
| - Within a priority group, selection is randomized among nodes that are not already connected. | ||
| - If multiple nodes are configured, the manager can switch to the next available node when latency limits or other criteria indicate it should. | ||
|
|
||
| ### Defaults and missing values | ||
|
|
||
| - If `http2ClientProtocolConfig` or `grpcClientProtocolConfig` are omitted, sensible defaults are used by the client. | ||
| - If `maxMessageSizeBytes` is omitted, the effective per-request limit defaults to 2,097,152 bytes (2 MB). | ||
|
|
||
| ### Live reload behavior | ||
|
|
||
| - The `block-nodes.json` file is watched for create/modify/delete events. | ||
| - On change, the manager reloads the file, shuts down any existing connections, and restarts with the new nodes. | ||
| - If the contents are unchanged, no restart is performed. | ||
| - If the file is missing or the contents fail to parse, the manager logs the issue and will not establish block node connections until a valid file is present again. | ||
|
|
||
| ### Validation notes | ||
|
|
||
| - Durations must be valid ISO-8601 strings (e.g. `"PT30S"`, `"PT1M"`). Invalid duration strings are ignored with a warning, and defaults apply for those fields. | ||
| - `priority` should be a non-negative integer. Use `0` for the highest priority. | ||
| - `address` must be resolvable by the OS DNS stack or be a valid IP address. If resolution fails, the active-connection-IP metric will report `-1` for that node. | ||
|
|
||
| ### Related configuration (outside this file) | ||
|
|
||
| While the JSON file declares the set of nodes and per-node protocol overrides, general streaming behavior is configured via the `blockNode` section in the application configuration (e.g. `blockNode.blockNodeConnectionFileDir`, backoff limits, latency thresholds, etc.). |
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.
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.
Uh oh!
There was an error while loading. Please reload this page.