Skip to content

Commit 77f9c74

Browse files
achamayouCopilot
andauthored
Rename /node/ledger-chunk to /node/ledger_chunk for consistency (#7763)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
1 parent d8dff9e commit 77f9c74

6 files changed

Lines changed: 53 additions & 49 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1414
- Added time-based snapshot scheduling. Snapshots can now be triggered after a configurable wall-clock interval (`snapshots.time_interval`) elapses, in addition to the existing transaction-count threshold (`snapshots.tx_count`). A new `snapshots.min_tx_count` option (default 2) sets the minimum number of transactions required before a time-based snapshot fires. Snapshot timing state is replicated to backups via a new `public:ccf.internal.snapshot_status` internal table (#7731).
1515
- Added support for endpoints that defer their HTTP response until the submitted transaction reaches a terminal consensus state (committed or invalidated). Endpoint authors can call `set_consensus_committed_function()` when installing an endpoint to register a callback that is invoked once the transaction is globally committed or invalidated. The callback receives the `ccf::TxID` and a `ccf::FinalTxStatus` (either `Committed` or `Invalid`), and may inspect or modify the response before it is sent. A built-in `ccf::endpoints::default_respond_on_commit_func` is provided that returns the original response on commit, or an error on invalidation. See the logging sample app (`/log/blocking/private`) for example usage (#7562).
1616

17+
### Changed
18+
19+
- Renamed `/node/ledger-chunk` and `/node/ledger-chunk/{chunk_name}` endpoints to `/node/ledger_chunk` and `/node/ledger_chunk/{chunk_name}` for consistency with the naming convention used by other `/node/*` endpoints.
20+
1721
### Fixed
1822

1923
- Fixed the Turin SEV-SNP CPUID mapping used for product detection (#7748).

doc/operations/configuration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The `enabled_operator_features` configuration field allows enabling or disabling
2929
Currently supported features are:
3030

3131
1. 'SnapshotRead': gates access to endpoints used to fetch snapshots directly from nodes (:http:GET:`/node/snapshot`, :http:HEAD:`/node/snapshot`, :http:GET:`/node/snapshot/{snapshot_name}` and :http:HEAD:`/node/snapshot/{snapshot_name}`).
32-
2. 'LedgerChunkRead': gates access to endpoints used to retrieve ledger chunks (:http:GET:`/node/ledger-chunk`, :http:HEAD:`/node/ledger-chunk`, :http:GET:`/node/ledger-chunk/{chunk_name}` and :http:HEAD:`/node/ledger-chunk/{chunk_name}`).
32+
2. 'LedgerChunkRead': gates access to endpoints used to retrieve ledger chunks (:http:GET:`/node/ledger_chunk`, :http:HEAD:`/node/ledger_chunk`, :http:GET:`/node/ledger_chunk/{chunk_name}` and :http:HEAD:`/node/ledger_chunk/{chunk_name}`).
3333

3434
Since these operations may require disk IO and produce large responses, these features should not be enabled on interfaces with public access, and instead restricted to interfaces with local connectivity for node-to-node and operator access.
3535

doc/operations/ledger_snapshot.rst

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Download Endpoints
5050
In order to facilitate long term backup of the ledger files (also called chunks), nodes can enable HTTP endpoints that allow a client to download committed ledger files.
5151
The `LedgerChunkRead` feature must be added to `enabled_operator_features` on the relevant `rpc_interfaces` entries in the node configuration.
5252

53-
1. :http:GET:`/node/ledger-chunk` and :http:HEAD:`/node/ledger-chunk`, both taking a `since` query parameter.
53+
1. :http:GET:`/node/ledger_chunk` and :http:HEAD:`/node/ledger_chunk`, both taking a `since=<seqno>` query parameter.
5454

5555
These endpoints can be used by a client to download the next ledger chunk including a given sequence number `<seqno>`.
5656
They redirect to the appropriate chunk if it exists, using the endpoints described below, or return a `404 Not Found` response if no such chunk is available.
@@ -61,17 +61,17 @@ In the typical case, a requesting client will first hit a Backup, and will event
6161

6262
sequenceDiagram
6363
Note over Client: Client asks for chunk starting at index
64-
Client->>+Backup: GET /node/ledger-chunk?since=index
65-
Backup->>-Client: 308 Location: /node/ledger-chunk/ledger_startIndex_endIndex.committed
64+
Client->>+Backup: GET /node/ledger_chunk?since=index
65+
Backup->>-Client: 308 Location: /node/ledger_chunk/ledger_startIndex_endIndex.committed
6666
Note over Backup: Backup node has that chunk
67-
Client->>+Backup: GET /node/ledger-chunk/ledger_startIndex_endIndex.committed
67+
Client->>+Backup: GET /node/ledger_chunk/ledger_startIndex_endIndex.committed
6868
Backup->>-Client: 200 <Chunk Contents>
69-
Client->>+Backup: GET /node/ledger-chunk?since=endIndex+1
69+
Client->>+Backup: GET /node/ledger_chunk?since=endIndex+1
7070
Note over Backup: Backup node does not yet have a committed chunk starting at endIndex+1
71-
Backup->>-Client: 308 Location: https://primary/node/ledger-chunk?since=endIndex+1
72-
Client->>+Primary: GET /node/ledger-chunk?since=endIndex+1
73-
Primary->>-Client: 308 Location: /node/ledger-chunk/ledger_endIndex+1_nextEndIndex.committed
74-
Client->>+Primary: GET /node/ledger-chunk/ledger_startIndex_endIndex.committed
71+
Backup->>-Client: 308 Location: https://primary/node/ledger_chunk?since=endIndex+1
72+
Client->>+Primary: GET /node/ledger_chunk?since=endIndex+1
73+
Primary->>-Client: 308 Location: /node/ledger_chunk/ledger_endIndex+1_nextEndIndex.committed
74+
Client->>+Primary: GET /node/ledger_chunk/ledger_startIndex_endIndex.committed
7575
Note over Primary: But the Primary node has the most recent chunk already
7676
Primary->>-Client: 200 <Chunk Contents>
7777

@@ -95,18 +95,18 @@ then the following sequence can occur:
9595
.. mermaid::
9696

9797
sequenceDiagram
98-
Client->>+Primary: GET /node/ledger-chunk?since=51
99-
Primary->>-Client: 308 Location: https://backup/node/ledger-chunk?since=51
100-
Client->>+Backup: GET /node/ledger-chunk?since=51
101-
Backup->>-Client: 308 Location: /node/ledger-chunk/ledger_51-100.committed
102-
Client->>+Backup: GET /node/ledger-chunk/ledger_51-100.committed
98+
Client->>+Primary: GET /node/ledger_chunk?since=51
99+
Primary->>-Client: 308 Location: https://backup/node/ledger_chunk?since=51
100+
Client->>+Backup: GET /node/ledger_chunk?since=51
101+
Backup->>-Client: 308 Location: /node/ledger_chunk/ledger_51-100.committed
102+
Client->>+Backup: GET /node/ledger_chunk/ledger_51-100.committed
103103
Backup->>-Client: 200 <Chunk Contents>
104-
Client->>+Backup: GET /node/ledger-chunk?since=101
104+
Client->>+Backup: GET /node/ledger_chunk?since=101
105105
Note over Backup: Backup node does not have 101-150
106-
Backup->>-Client: 308 Location: https://primary/node/ledger-chunk?since=51
107-
Client->>+Primary: GET /node/ledger-chunk?since=101
106+
Backup->>-Client: 308 Location: https://primary/node/ledger_chunk?since=51
107+
Client->>+Primary: GET /node/ledger_chunk?since=101
108108

109-
2. :http:GET:`/node/ledger-chunk/{chunk_name}` and :http:HEAD:`/node/ledger-chunk/{chunk_name}`
109+
2. :http:GET:`/node/ledger_chunk/{chunk_name}` and :http:HEAD:`/node/ledger_chunk/{chunk_name}`
110110

111111
These endpoints allow downloading a specific ledger chunk by name, where `<chunk-name>` is of the form `ledger_<start_seqno>-<end_seqno>.committed`.
112112
They support the HTTP `Range` header for partial downloads, and the `HEAD` method for clients to query metadata such as the total size without downloading the full chunk.
@@ -126,7 +126,7 @@ This allows clients to verify the integrity of downloaded files and avoid re-dow
126126
ETag and If-None-Match
127127
^^^^^^^^^^^^^^^^^^^^^^
128128

129-
``GET /node/ledger-chunk/{chunk_name}`` supports ``ETag`` and ``If-None-Match`` headers, allowing clients to atomically check whether a chunk (or a range of a chunk) has changed and re-download it in a single request, without needing a separate metadata query first.
129+
``GET /node/ledger_chunk/{chunk_name}`` supports ``ETag`` and ``If-None-Match`` headers, allowing clients to atomically check whether a chunk (or a range of a chunk) has changed and re-download it in a single request, without needing a separate metadata query first.
130130
Every successful ``GET`` response includes an ``ETag`` header whose value uses the `RFC 9530 <https://www.rfc-editor.org/rfc/rfc9530>`_ digest format: ``"sha-256=:<base64_digest>:"``, where ``<base64_digest>`` is the base64-encoded SHA-256 digest of the returned content (which may be a sub-range when the ``Range`` header is used).
131131

132132
.. note:: ETag values must be surrounded by double quotes, as per `RFC 7232 <https://www.rfc-editor.org/rfc/rfc7232#section-2.3>`_.
@@ -140,7 +140,7 @@ When the client already holds a chunk and wants to check if it has changed, it s
140140

141141
sequenceDiagram
142142
Note over Client: Client already has chunk with known ETag
143-
Client->>+Node: GET /node/ledger-chunk/ledger_1-100.committed<br/>If-None-Match: "sha-256=:47DEQpj8HBSa+/TImW...=:"
143+
Client->>+Node: GET /node/ledger_chunk/ledger_1-100.committed<br/>If-None-Match: "sha-256=:47DEQpj8HBSa+/TImW...=:"
144144
Note over Node: Computes digest, matches If-None-Match
145145
Node->>-Client: 304 Not Modified<br/>ETag: "sha-256=:47DEQpj8HBSa+/TImW...=:"
146146
Note over Client: No body transferred, client keeps existing copy
@@ -151,7 +151,7 @@ If the ``If-None-Match`` ETag does not match the current content (e.g. the clien
151151

152152
sequenceDiagram
153153
Note over Client: Client sends an ETag that does not match
154-
Client->>+Node: GET /node/ledger-chunk/ledger_1-100.committed<br/>If-None-Match: "sha-256=:AAAA...=:"
154+
Client->>+Node: GET /node/ledger_chunk/ledger_1-100.committed<br/>If-None-Match: "sha-256=:AAAA...=:"
155155
Note over Node: Computes digest, does not match If-None-Match
156156
Node->>-Client: 200 OK<br/>ETag: "sha-256=:47DEQpj8HBSa+/TImW...=:"<br/><Chunk Contents>
157157
Note over Client: Client stores chunk and new ETag for future requests

doc/schemas/node_openapi.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,9 +1200,9 @@
12001200
}
12011201
}
12021202
},
1203-
"/node/ledger-chunk": {
1203+
"/node/ledger_chunk": {
12041204
"get": {
1205-
"description": "Redirect to the corresponding /node/ledger-chunk/{chunk_name} endpoint for the ledger chunk including the sequence number specified in the 'since' query parameter.",
1205+
"description": "Redirect to the corresponding /node/ledger_chunk/{chunk_name} endpoint for the ledger chunk including the sequence number specified in the 'since' query parameter.",
12061206
"operationId": "GetNodeLedgerChunk",
12071207
"parameters": [
12081208
{
@@ -1228,7 +1228,7 @@
12281228
}
12291229
},
12301230
"head": {
1231-
"description": "Redirect to the corresponding /node/ledger-chunk/{chunk_name} endpoint for the ledger chunk including the sequence number specified in the 'since' query parameter.",
1231+
"description": "Redirect to the corresponding /node/ledger_chunk/{chunk_name} endpoint for the ledger chunk including the sequence number specified in the 'since' query parameter.",
12321232
"operationId": "HeadNodeLedgerChunk",
12331233
"parameters": [
12341234
{
@@ -1254,7 +1254,7 @@
12541254
}
12551255
}
12561256
},
1257-
"/node/ledger-chunk/{chunk_name}": {
1257+
"/node/ledger_chunk/{chunk_name}": {
12581258
"get": {
12591259
"description": "Download a specific ledger chunk by name. Supports HTTP Range header for partial downloads.",
12601260
"operationId": "GetNodeLedgerChunkChunkName",

src/node/rpc/file_serving_handlers.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ namespace ccf::node
719719
const auto chunk_filename = chunk_path.value().filename();
720720

721721
auto redirect_url = fmt::format(
722-
"https://{}/node/ledger-chunk/{}", address.value(), chunk_filename);
722+
"https://{}/node/ledger_chunk/{}", address.value(), chunk_filename);
723723
LOG_DEBUG_FMT("Redirecting to ledger chunk: {}", redirect_url);
724724
ctx.rpc_ctx->set_response_header(
725725
ccf::http::headers::LOCATION, redirect_url);
@@ -746,7 +746,7 @@ namespace ccf::node
746746
}
747747

748748
auto location = fmt::format(
749-
"https://{}/node/ledger-chunk?{}={}",
749+
"https://{}/node/ledger_chunk?{}={}",
750750
address.value(),
751751
file_since_param_key,
752752
since_idx);
@@ -773,7 +773,7 @@ namespace ccf::node
773773
if (address.has_value())
774774
{
775775
auto location =
776-
fmt::format("https://{}/node/ledger-chunk", address.value());
776+
fmt::format("https://{}/node/ledger_chunk", address.value());
777777
location += fmt::format("?{}={}", file_since_param_key, since_idx);
778778

779779
ctx.rpc_ctx->set_response_header(http::headers::LOCATION, location);
@@ -799,27 +799,27 @@ namespace ccf::node
799799
};
800800
registry
801801
.make_read_only_endpoint(
802-
"/ledger-chunk", HTTP_HEAD, find_chunk, no_auth_required)
802+
"/ledger_chunk", HTTP_HEAD, find_chunk, no_auth_required)
803803
.set_forwarding_required(endpoints::ForwardingRequired::Never)
804804
.add_query_parameter<ccf::SeqNo>(
805805
file_since_param_key, ccf::endpoints::RequiredParameter)
806806
.require_operator_feature(endpoints::OperatorFeature::LedgerChunkRead)
807807
.set_openapi_summary("Ledger chunk metadata")
808808
.set_openapi_description(
809-
"Redirect to the corresponding /node/ledger-chunk/{chunk_name} "
809+
"Redirect to the corresponding /node/ledger_chunk/{chunk_name} "
810810
"endpoint for the ledger chunk including the sequence number specified "
811811
"in the 'since' query parameter.")
812812
.install();
813813
registry
814814
.make_read_only_endpoint(
815-
"/ledger-chunk", HTTP_GET, find_chunk, no_auth_required)
815+
"/ledger_chunk", HTTP_GET, find_chunk, no_auth_required)
816816
.set_forwarding_required(endpoints::ForwardingRequired::Never)
817817
.add_query_parameter<ccf::SeqNo>(
818818
file_since_param_key, ccf::endpoints::RequiredParameter)
819819
.require_operator_feature(endpoints::OperatorFeature::LedgerChunkRead)
820820
.set_openapi_summary("Download ledger chunk")
821821
.set_openapi_description(
822-
"Redirect to the corresponding /node/ledger-chunk/{chunk_name} "
822+
"Redirect to the corresponding /node/ledger_chunk/{chunk_name} "
823823
"endpoint for the ledger chunk including the sequence number specified "
824824
"in the 'since' query parameter.")
825825
.install();
@@ -938,7 +938,7 @@ namespace ccf::node
938938
};
939939
registry
940940
.make_command_endpoint(
941-
"/ledger-chunk/{chunk_name}",
941+
"/ledger_chunk/{chunk_name}",
942942
HTTP_HEAD,
943943
get_ledger_chunk,
944944
no_auth_required)
@@ -951,7 +951,7 @@ namespace ccf::node
951951
.install();
952952
registry
953953
.make_command_endpoint(
954-
"/ledger-chunk/{chunk_name}",
954+
"/ledger_chunk/{chunk_name}",
955955
HTTP_GET,
956956
get_ledger_chunk,
957957
no_auth_required)

0 commit comments

Comments
 (0)