Read plans
The gRPC call that names the objects in storage holding a stream's older records, so a reader can fetch them itself.
A read plan lists the objects in storage that hold a stream's older
records. A reader with a plan fetches those bytes from object storage itself,
so reading history costs the nodes nothing. The call is gRPC only, a method of
nova.v1.DataPlaneService. The Gateway
uses plans to serve history; the SDKs do not. Most callers never need one:
read returns the same records.
Read plans move history off the nodes
Why plans exist, and what they save
Read records
The ordinary read, on every transport
Stream objects
The object format a plan's reader decodes
Get a read plan
gRPC: DataPlaneService.ReadPlan. Returns the stream objects that hold a
stream's records from a start, and the sequence number where the plan stops.
Any node answers, so the call does not need the stream's leader.
| Request field | Type | Default | Meaning |
|---|---|---|---|
bucket, key | string | Required | The stream |
seq_num | integer | None | Start at the record with this sequence number. Send this or timestamp_ms |
timestamp_ms | integer | None | Start at the first record stamped at or after this time |
limit | integer | 256 | The most entries, cut to the node's limit, 256. At least one is returned |
clamp | boolean | false | Start a plan below the trim watermark at the first stored record. Without it, such a plan fails with OUT_OF_RANGE |
There is no tail_offset: to plan from N records before the tail,
check the tail first.
grpcurl -plaintext -import-path proto -proto nova/v1/dataplane.proto -d '{
"bucket": "demo",
"key": "events",
"seq_num": 0
}' \
localhost:7781 nova.v1.DataPlaneService/ReadPlan{
"entries": [
{
"url": "mem://streams/demo/01a204f2-d52b-7687-abbf-c500b962b65b/1/00000000000000000000?ttl=5m0s",
"footerOff": "18",
"footerLen": "159",
"payloadBytes": "15",
"minTimestampMs": "1795379352914",
"maxTimestampMs": "1795379352914"
}
],
"vendedUntil": "3",
"expiresAtUnixMs": "1795379683741"
}This response came from a node that kept its objects in memory, so the URL is
a mem:// one. A node on S3 or RustFS returns a presigned HTTP URL. gRPC JSON leaves out fields that are zero, so the
entry's first_seq_num, 0, is absent. The stream held three records, all in
this one object, so the plan covers sequence numbers 0 to 2 and stops at 3.
| Response field | Meaning |
|---|---|
entries | One per stream object, in order. Each entry's records end where the next entry's begin, and the last ends at vended_until |
entries[].url | A presigned URL for the whole object, valid until expires_at_unix_ms. Send your own Range headers. Nodes return this by default (novad --readplan-vending presigned) |
entries[].object | storage_bucket and object_key, for a reader that fetches with its own storage credentials. Nodes return this with novad --readplan-vending raw |
entries[].footer_off, footer_len | The byte range of the object's directory, which says where each record is |
entries[].payload_bytes | The object's data bytes, for sizing the fetch |
entries[].first_seq_num | The sequence number of the object's first record |
entries[].min_timestamp_ms, max_timestamp_ms | The times of the object's records. A timestamp_ms start picks an entry by these, and the reader finds the record in its directory |
vended_until | The first sequence number the plan does not cover. From there on, use read or subscribe. Absent when a timestamp_ms start is past every stream object: read from that same time |
more | The plan stopped at its entry limit: ask again from vended_until |
expires_at_unix_ms | When the plan stops being valid: half the auditor's read grace after the call, 5 minutes by default. Zero when the plan has no entries |
| Status | When | Retry |
|---|---|---|
NOT_FOUND | No stream at the address. A plan never creates one | No |
OUT_OF_RANGE | The start is below the trim watermark | With clamp: true |
PERMISSION_DENIED | The token has no read grant on the stream | No |
UNIMPLEMENTED | The node keeps its data on local disk (novad --local-data) and makes no plans | No. Use read |
Read with a plan
- Ask for a plan from your start.
- For each entry, fetch the directory at
footer_offandfooter_len, then fetch only the byte ranges of the records you need. The stream object format describes the directory. - When
moreistrue, ask for the next plan fromvended_until. - From
vended_untilon, read or subscribe through a node as usual. - Finish each fetch before
expires_at_unix_ms, or ask for a new plan.
A plan covers only records that Nova has already copied into stream objects, so it never holds the newest records. Those wait in shared objects for up to 24 hours on Standard and 1 hour on Express, and a node serves them. A fresh stream's plan has no entries:
{
"vendedUntil": "0"
}An out-of-date plan is still correct, and every object a valid plan names
still exists: Nova deletes an object only once the read grace has passed
since its last reference, twice a plan's lifetime. On a scalable stream a plan
names no range and vends nothing, so read it through a node. A plan needs the
same read grant as a read.