You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`GET` and `HEAD``/node/ledger-chunk?since={seqno}` and `/node/ledger-chunk/{chunk_name}` endpoints, gated by the `LedgerChunkDownload` RPC interface operator feature. See [documentation](https://microsoft.github.io/CCF/main/operations/ledger_snapshot.html#download-endpoints) for more detail.
Copy file name to clipboardExpand all lines: doc/operations/ledger_snapshot.rst
+68Lines changed: 68 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,74 @@ The listing below is an example of what a ledger directory may look like:
44
44
- While the :doc:`/operations/recovery` procedure is in progress, new ledger files are suffixed with ``.recovery``. These files are automatically renamed (i.e. recovery suffix removed) once the recovery procedure is complete. ``.recovery`` files are automatically discarded on node startup so that a failed recovery attempt does not prevent further recoveries.
45
45
- A new ledger chunk can also be created by the ``trigger_ledger_chunk`` governance action, which will automatically produce a new chunk at the following signature transaction.
46
46
47
+
Download Endpoints
48
+
~~~~~~~~~~~~~~~~~~
49
+
50
+
In order to faciliate long term backup of the ledger files (also called chunks), nodes can enable HTTP endpoints that allow a client to download committed ledger files.
51
+
The `LedgerChunkDownload` feature must be added to `enabled_operator_features` on the relevant `rpc_interfaces` entries in the node configuration.
52
+
53
+
1. :http:GET:`/node/ledger-chunk/{chunk_name}` and :http:HEAD:`/node/ledger-chunk/{chunk_name}`
54
+
55
+
These endpoints allow downloading a specific ledger chunk by name, where `<chunk-name>` is of the form `ledger_<start_seqno>-<end_seqno>.committed`.
56
+
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.
57
+
They also populate the `x-ms-ccf-ledger-chunk-name` response header with the name of the chunk being served.
58
+
59
+
2. :http:GET:`/node/ledger-chunk` and :http:HEAD:`/node/ledger-chunk`, both taking a `seqno` query parameter.
60
+
61
+
These endpoints can be used by a client to download the next ledger chunk including a given sequence number `<seqno>`.
62
+
The redirects to the appropriate chunk if it exists, using the previous set of endpoints, or returns a `404 Not Found` response if no such chunk is available.
63
+
64
+
In the usual case, a downloading client will first hit a Backup, and will eventually want to download files recent enough that only the primary can provide them:
65
+
66
+
.. mermaid::
67
+
68
+
sequenceDiagram
69
+
Note over Client: Client asks for chunk starting at index
70
+
Client->>+Backup: GET /node/ledger-chunk?since=index
Copy file name to clipboardExpand all lines: doc/schemas/node_openapi.json
+99-1Lines changed: 99 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -918,7 +918,7 @@
918
918
"info": {
919
919
"description": "This API provides public, uncredentialed access to service and node state.",
920
920
"title": "CCF Public Node API",
921
-
"version": "4.16.0"
921
+
"version": "5.0.3"
922
922
},
923
923
"openapi": "3.0.0",
924
924
"paths": {
@@ -1166,6 +1166,104 @@
1166
1166
}
1167
1167
}
1168
1168
},
1169
+
"/node/ledger-chunk": {
1170
+
"get": {
1171
+
"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.",
1172
+
"operationId": "GetNodeLedgerChunk",
1173
+
"parameters": [
1174
+
{
1175
+
"in": "query",
1176
+
"name": "since",
1177
+
"required": true,
1178
+
"schema": {
1179
+
"$ref": "#/components/schemas/uint64"
1180
+
}
1181
+
}
1182
+
],
1183
+
"responses": {
1184
+
"200": {
1185
+
"description": "Default response description"
1186
+
},
1187
+
"default": {
1188
+
"$ref": "#/components/responses/default"
1189
+
}
1190
+
},
1191
+
"summary": "Download ledger chunk",
1192
+
"x-ccf-forwarding": {
1193
+
"$ref": "#/components/x-ccf-forwarding/never"
1194
+
}
1195
+
},
1196
+
"head": {
1197
+
"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.",
1198
+
"operationId": "HeadNodeLedgerChunk",
1199
+
"parameters": [
1200
+
{
1201
+
"in": "query",
1202
+
"name": "since",
1203
+
"required": true,
1204
+
"schema": {
1205
+
"$ref": "#/components/schemas/uint64"
1206
+
}
1207
+
}
1208
+
],
1209
+
"responses": {
1210
+
"200": {
1211
+
"description": "Default response description"
1212
+
},
1213
+
"default": {
1214
+
"$ref": "#/components/responses/default"
1215
+
}
1216
+
},
1217
+
"summary": "Ledger chunk metadata",
1218
+
"x-ccf-forwarding": {
1219
+
"$ref": "#/components/x-ccf-forwarding/never"
1220
+
}
1221
+
}
1222
+
},
1223
+
"/node/ledger-chunk/{chunk_name}": {
1224
+
"get": {
1225
+
"description": "Download a specific ledger chunk by name. Supports HTTP Range header for partial downloads.",
1226
+
"operationId": "GetNodeLedgerChunkChunkName",
1227
+
"responses": {
1228
+
"200": {
1229
+
"description": "Default response description"
1230
+
},
1231
+
"default": {
1232
+
"$ref": "#/components/responses/default"
1233
+
}
1234
+
},
1235
+
"summary": "Download ledger chunk",
1236
+
"x-ccf-forwarding": {
1237
+
"$ref": "#/components/x-ccf-forwarding/never"
1238
+
}
1239
+
},
1240
+
"head": {
1241
+
"description": "Metadata about a specific ledger chunk (Content-Length and x-ms-ccf-ledger-chunk-name)",
0 commit comments