Streams
A stream is an ordered sequence of records with permanent sequence numbers, stored in object storage.
A stream is an ordered sequence of records. You append records to its end and read them back from any position. Each stream lives in a bucket and has an address, nova://bucket/key. This is the stream demo/events as the API returns it:
{
"stream_id": "01a20481-2cd9-77cc-9a6f-68eedc13ab23",
"bucket": "demo",
"key": "events",
"kind": "plain",
"class": "standard",
"producer_policy": "any",
"timestamping_mode": "client-prefer",
"created_at_unix_ms": 1795371904217,
"fencing_token": ""
}You name a stream by its address in every call. The stream_id is a permanent ID that Nova gives the stream when it creates it. The other fields are the stream's settings, which Settings lists with their defaults.
Sequence numbers
Nova numbers a stream's records 0, 1, 2, … in the order it stores them. The numbers have no gaps, and a record keeps its number for as long as it exists. Trimming removes old records without renumbering the rest: after a trim below 1000, the first record is still number 1000.
Order exists only inside one stream. Two records in different streams have no order between them, even when their timestamps differ. Put records in the same stream when their order matters.
The tail
The tail is the end of the stream. It is a position: the sequence number the next record will get, and the timestamp of the last record.
{
"bookmark": "3",
"tail": {
"seq_num": 3,
"timestamp_ms": 1795371906316
}
}A new stream's tail is {"seq_num": 0, "timestamp_ms": 0}. The bookmark is the place to resume a read, described on Bookmarks.
The tail counts only records Nova has acknowledged, and it never moves back. Every append, read, and subscription response carries the tail as it was when Nova replied, so a later append can move it on. To learn where the stream ends now, check the tail: the answer includes every append acknowledged before you asked. Reads explains when to check it.
Plain and scalable streams
A stream's kind is set when you create it and never changes:
| Kind | Order | Throughput | Use when |
|---|---|---|---|
plain | One order for every record | What one node can write | You need one order, or conditional appends. This is the default. |
scalable | One order per routing key | Grows as Nova splits the stream into ranges | One stream must take more writes than one node can, and order per key is enough |
The pages in this section describe plain streams. Scalable streams explains what changes.
Creating and deleting streams
You create a stream explicitly, or let its bucket create it on the first append or read. A stream costs little to keep, so you can give each user, device, order, or job its own. Model your data shows how to choose.
Deleting a stream makes its records unreadable at once. A background process reclaims their storage later. If you create a stream at the same address again, it gets a new ID and an empty history, with sequence numbers starting at 0. It cannot read the old stream's records.