Records

Records

A record is one item in a stream, with a body, optional headers, a timestamp, and a sequence number.

A record is one item in a stream. It holds a body of bytes, optional headers, a timestamp, and a sequence number. Nova stores the body and headers as you sent them and never reads their contents. This is a record as a read returns it:

A record from GET /v1/streams/demo/orders/records
{
  "seq_num": 0,
  "timestamp_ms": 1795371726403,
  "body": "{\"order\":\"eu-1017\",\"status\":\"shipped\"}",
  "headers": [
    {
      "name": "content-type",
      "value": "application/json"
    }
  ]
}

Fields

FieldSet byWhat it is
bodyYouThe record's bytes. Text, JSON, protobuf, or anything else.
headersYouOptional name and value pairs, returned in the order you sent them
timestamp_msYou or NovaThe record's time in milliseconds, chosen by the stream's timestamping mode
seq_numNovaThe record's sequence number, its position in the stream
rangeNovaOn a scalable stream only: the range that holds the record

A header's name and value are bytes. A name cannot be empty, and the same name can appear more than once. A record holds at most 64 headers. A node's HTTP API takes up to 100 for a stream that node leads, but the SDKs and the Gateway stop at 64, so keep to 64. A batch with an invalid header fails whole with 400.

Nova uses a few header names that start with nova-. On a scalable stream, nova-routing-key holds the record's routing key. Queue messages carry their own nova- headers.

Size

A record's size is its body plus every header name and value. Encoding does not count: a body sent as base64 over HTTP is measured after decoding.

A record holds at most 1 MiB by default, and so does a batch. A larger record is refused. To store a bigger payload, put it in object storage and append a record that points to it, such as its object key. An operator can change these bounds; API limits lists them.

Timestamps

Every record has a timestamp in milliseconds. Within a stream, timestamps never go down: Nova raises a timestamp that is earlier than the previous record's to match it. This is what lets a read or a trim start at a time without scanning the stream.

The stream's timestamping mode decides whose clock Nova uses:

ModeYou send a timestampYou send none
client-prefer (the default)Nova uses it, but not later than the time it arrivedNova uses the arrival time
client-requireNova uses it, but not later than the time it arrivedThe batch is refused with 400
arrivalThe batch is refused with 400Nova uses the arrival time

Nova caps your timestamps at the arrival time, so a client with a fast clock cannot push the stream into the future. For a scale that is not a clock, such as a database's log sequence number, make the stream uncapped (timestamping_uncapped). Nova then keeps the value you send, even one later than the arrival time. A value lower than the previous record's is still raised to match it, so send values that only go up.

An uncapped stream cannot have age-based retention, because retention reads timestamps as clock time. Nova refuses a stream or bucket that sets both.

You set the mode when you create the stream, or it comes from the bucket's defaults. Settings says when a change takes effect.

See also

On this page