Streams
The routes that create, read, change, list, and delete streams.
A stream is an ordered log of records at an address, a bucket and a key.
These routes manage streams themselves; the records inside them are on
Records. Each route is also a method of the gRPC service
nova.v1.DataPlaneService.
Streams
What a stream is, and its tail
Create and manage streams with an SDK
The same calls in Go and TypeScript
Stream commands
The same operations from the nova CLI
| Operation | HTTP | gRPC |
|---|---|---|
| Create | POST /v1/streams/{bucket}/{key} | CreateStream |
| Get | GET /v1/streams/{bucket}/{key} | GetStream |
| Reconfigure | PATCH /v1/streams/{bucket}/{key} | ReconfigureStream |
| List | GET /v1/streams/{bucket} | ListStreams |
| Delete | DELETE /v1/streams/{bucket}/{key} | DeleteStream |
The examples use the quickstart cluster's Gateway at
localhost:8080 and the bucket demo. A key is one percent-encoded path
segment: the key orders/eu is orders%2Feu.
The stream object
Every route that returns a stream returns this object:
{
"stream_id": "01a20475-ebde-7ec9-9422-c12d2bc2931f",
"bucket": "demo",
"key": "orders",
"kind": "plain",
"class": "standard",
"producer_policy": "fenced",
"retention_max_age_ms": 86400000,
"timestamping_mode": "client-prefer",
"created_at_unix_ms": 1795371166686,
"fencing_token": ""
}The JSON leaves out a field whose value is zero or false. So a stream without
retention_max_age_ms keeps records however old.
Over gRPC the object is Stream. Its stream_id is 16 bytes, base64 in gRPC
JSON. The enums are CLASS_STANDARD, CLASS_EXPRESS, PRODUCER_POLICY_ANY,
PRODUCER_POLICY_FENCED, TIMESTAMPING_MODE_CLIENT_PREFER,
TIMESTAMPING_MODE_CLIENT_REQUIRE, TIMESTAMPING_MODE_ARRIVAL,
STREAM_KIND_PLAIN, and STREAM_KIND_SCALABLE. It also carries
creation_token, and deleted_at_unix_ms once the stream is deleted.
Create a stream
POST /v1/streams/{bucket}/{key}gRPC: DataPlaneService.CreateStream. Creates a stream in an existing bucket
and returns it with 201.
curl -s -X POST localhost:8080/v1/streams/demo/orders -d '{
"producer_policy": "fenced",
"retention_max_age_ms": 86400000
}'{
"stream_id": "01a20475-ebde-7ec9-9422-c12d2bc2931f",
"bucket": "demo",
"key": "orders",
"kind": "plain",
"class": "standard",
"producer_policy": "fenced",
"retention_max_age_ms": 86400000,
"timestamping_mode": "client-prefer"
}A field you leave out, or an enum sent as UNSPECIFIED over gRPC, is copied
from the bucket's defaults when the stream is created. A later change to the bucket does not reach the stream. An empty body
creates a stream with all of the bucket's defaults.
A create that times out may have created the stream. Send it again with the same creation_token, and Nova returns
201 with the stream the first attempt made. Without a token, or with another
token, the retry fails with 409:
curl -s -X POST localhost:8080/v1/streams/demo/orders{
"error": "star: create 01a20475-ec10-779d-b00c-4e2341392ae5: metadata: stream exists"
}| Status | When | Retry |
|---|---|---|
| 400 | The body is not valid JSON, or names an unknown class, policy, mode, or kind | No. Fix the request |
| 404 | The bucket does not exist. Nova never creates a bucket for you | After you create the bucket |
| 409 | A stream or a queue already holds the address | Only with the first attempt's creation_token |
| 500 | A setting the node checks after the request is read: a key longer than 512 bytes or with a control character, timestamping_uncapped with age retention, more than 256 ranges, or initial_ranges on a plain stream. The node reports these as 500 today | No. Fix the request |
Express needs Express storage
A create accepts class: express even when the cluster has no Express storage.
Every append to that stream then fails with 500. A reconfigure checks first
and refuses with 503. Create Express streams only on a cluster that serves
the class.
Get a stream
GET /v1/streams/{bucket}/{key}gRPC: DataPlaneService.GetStream. Returns the stream object, with
its created_at_unix_ms and its installed fencing_token.
curl -s localhost:8080/v1/streams/demo/ordersThe response is the object at the top of this page. A writer that needs the current fencing token reads it here, without having to fail an append first.
| Status | When | Retry |
|---|---|---|
| 404 | No stream at the address, or it was deleted | No |
Reconfigure a stream
PATCH /v1/streams/{bucket}/{key}gRPC: DataPlaneService.ReconfigureStream. Changes the fields the body names,
and returns the stream as it now stands.
The body takes class, producer_policy, retention_max_age_ms,
retention_max_bytes, throughput_max_bytes_per_second,
timestamping_mode, and timestamping_uncapped. A field you leave out keeps
its value. A field you send is set, zero included, so 0 returns a bound to
no limit:
curl -s -X PATCH localhost:8080/v1/streams/demo/orders -d '{
"retention_max_age_ms": 0
}'{
"stream_id": "01a20475-ebde-7ec9-9422-c12d2bc2931f",
"bucket": "demo",
"key": "orders",
"kind": "plain",
"class": "standard",
"producer_policy": "fenced",
"timestamping_mode": "client-prefer",
"created_at_unix_ms": 1795371166686
}A retention change applies at once. A change to the class, the producer policy, timestamping, or throughput moves the stream to a new leader before the response, so every later append follows the new setting. A connected producer reconnects once. Records already acknowledged keep the class they were written under. The kind cannot change.
| Status | When | Retry |
|---|---|---|
| 400 | An unknown value, or an enum sent as "" | No. Fix the request |
| 404 | No stream at the address | No |
409 with reason: queue_address | The address holds a queue. Change it with the queue routes | No |
| 503 | A class this cluster does not serve, or the leader is moving | Not for the class. Otherwise, after Retry-After |
The stream's leader serves the change. Over gRPC, StreamReconfiguration
marks every field optional, so an absent field stays as it is. An enum must
name a value; UNSPECIFIED is refused with InvalidArgument. Another node
answers FailedPrecondition with NotOwner. Reconfiguring needs the create
grant on the address.
List a bucket's streams
GET /v1/streams/{bucket}gRPC: DataPlaneService.ListStreams. Returns one page of a bucket's streams.
curl -s 'localhost:8080/v1/streams/demo?limit=2'{
"streams": [
{
"stream_id": "01a20475-ec38-73dc-9df7-cdf7111475dd",
"bucket": "demo",
"key": "clicks",
"kind": "scalable",
"class": "standard",
"producer_policy": "any",
"timestamping_mode": "client-prefer",
"created_at_unix_ms": 1795371166776
},
{
"stream_id": "01a20475-ec76-727c-b0ae-9eb3c4990ec0",
"bucket": "demo",
"key": "events",
"kind": "plain",
"class": "standard",
"producer_policy": "any",
"timestamping_mode": "client-prefer",
"created_at_unix_ms": 1795371166838
}
],
"next": "AaIEdex2cnywrp6zxJkOwA"
}Pass next as start_after to read the following page. A response without
next is the last page. The cursor is opaque. With key_prefix, the response
also returns the prefix it applied as key_prefix. A listing never includes
fencing_token, and covers one bucket only.
| Status | When | Retry |
|---|---|---|
| 400 | A start_after that is not a cursor, or a bad prefix | No |
| 403 | The token's list grant does not cover every key the prefix names | No |
Over gRPC, bucket is required. A response with an empty key_prefix to a
request that sent one comes from a server too old to filter.
Delete a stream
DELETE /v1/streams/{bucket}/{key}gRPC: DataPlaneService.DeleteStream. Deletes the stream and returns 204.
Nova reclaims its storage later, in the background.
curl -s -X DELETE localhost:8080/v1/streams/demo/eventsDeleting is safe to retry: a second delete of the same stream also returns
204. A new stream created at the address starts empty, with a new
stream_id.
| Status | When | Retry |
|---|---|---|
| 404 | No stream ever existed at the address | No |
409 with reason: queue_address | The address holds a queue. Use the queue's delete | No |
| 503 | The leader is moving | Yes, after Retry-After |
The stream's leader serves the delete. Deleting needs the delete grant, which
is separate from trim. A deleted stream still counts against its bucket for a
few minutes, until Nova has reclaimed its storage, so a
bucket delete right after it is refused. The same
call is Delete a stream
in the SDKs and nova stream delete in the
CLI. Statuses every route shares are on Errors.