Record commands

Record commands

The nova commands that append, read, follow, trim, and fence the records of one stream.

The record commands write lines to a stream and print its records. Each takes the stream's address, nova://bucket/key, and needs a server address from --addr or NOVA_ADDR, as Connect explains. The examples use the quickstart cluster and ran with TZ=UTC; times print in your local time zone.

export NOVA_ADDR=localhost:7781
CommandDoes
nova appendAppends each line of standard input as one record
nova readPrints records from a starting point, and can follow new ones
nova tailPrints the last records, and can follow new ones
nova check-tailPrints where the stream ends
nova stream trimRemoves the records before a point
nova fenceInstalls, replaces, or clears the stream's fencing token

Every command exits 0 when it succeeds, 1 when it ran and failed, and 2 on a usage error. See Exit codes.

nova append

Appends each line of standard input to a stream as one record.

nova append [options] <nova://bucket/key>

Append from a pipe

printf 'hello\nworld\n' | nova append nova://demo/events
appended 2 entries

Append a file

nova append nova://demo/events < events.txt
appended 3 entries

Send each line at once

The command waits up to 5 ms to put more lines in one batch. Set --linger 0 to send every line as soon as it is read, for example when a person types the lines.

printf 'logout\n' | nova append --linger 0 nova://demo/events
appended 1 entries

Each line becomes one record, and its bytes are the body, without the newline. A record gets no headers. A line longer than 64 KiB stops the command with nova: append: stdin: bufio.Scanner: token too long. For binary bodies or headers, use an SDK or the API.

The command sends the lines through one producer session. It groups them into batches and sends the next batch without waiting for the last one's acknowledgement. Once standard input ends and Nova has acknowledged every batch, it prints the count. If a batch fails, the command stops reading, waits for the batches it already sent, and exits 1 without printing a count. The records Nova acknowledged before the failure stay in the stream: run nova check-tail to see where it ends.

If the connection drops, the command reconnects for up to 30 seconds and resends the unacknowledged batches. When an acknowledgement was lost, Nova can store that batch twice. With an http:// or https:// address, the session runs over HTTP.

On a scalable stream, the command sets no routing key, so each line goes to a range picked at random. To choose the range, append by key with an SDK.

--fencing-tokenDefaultNone
Presents this fencing token. It must equal the token nova fence installed
--lingerDefault5ms
The longest wait to fill a batch. 0 sends each batch at once

The concept is Appends. The same task is Append records with an SDK and Append records over the API.

nova read

Prints records from a starting point, one per line: the sequence number, the time, and the body, separated by tabs.

nova read [options] <nova://bucket/key>

Read from the beginning

Without --from or --since, the read starts at the earliest record still stored.

nova read nova://demo/events
0	2026-11-22T14:59:33Z	hello
1	2026-11-22T14:59:33Z	world
2	2026-11-22T14:59:36Z	signup
3	2026-11-22T14:59:36Z	login
4	2026-11-22T14:59:36Z	purchase
5	2026-11-22T14:59:36Z	logout

Read a range

nova read nova://demo/events --from 2 --limit 2
2	2026-11-22T14:59:36Z	signup
3	2026-11-22T14:59:36Z	login

Read from a time

--since starts at the first record stamped at or after an RFC 3339 time.

nova read nova://demo/events --since 2026-11-22T14:59:36Z
2	2026-11-22T14:59:36Z	signup
3	2026-11-22T14:59:36Z	login
4	2026-11-22T14:59:36Z	purchase
5	2026-11-22T14:59:36Z	logout

Follow new records

With --follow, the command prints the records from the start, then waits and prints each new record as it arrives. Press Ctrl-C to stop. Here a second terminal appended refund:

nova read -f nova://demo/events --from 5
5	2026-11-22T14:59:36Z	logout
6	2026-11-22T14:59:37Z	refund

Without --follow, the command stops after --limit records or at the tail. It prints only the body of each record, as raw bytes, and no headers. Times have whole seconds. A --from below the trim watermark fails with nova: client: records trimmed: … and exit code 1. Leave out --from to start at the first record still stored.

On a scalable stream, each range numbers its own records from 0, so the first column can repeat. --from names a position in one range, so there it fails with nova: cluster: positions are per range on a scalable stream: …. Start from the beginning or with --since instead.

--fromDefaultThe earliest stored record
The first sequence number to print
--sinceDefaultNone
Start at the first record stamped at or after this RFC 3339 time
--limitDefault100
Stop after this many records. Ignored with --follow
--follow, -fDefaultOff
Keep printing new records until you stop the command

The concept is Reads. The same task is Read and follow with an SDK, and Read records and Subscribe over the API.

nova tail

Prints a stream's last records, oldest first, in the same form as nova read.

nova tail [options] <nova://bucket/key>
nova tail -n 3 nova://demo/events
4	2026-11-22T14:59:36Z	purchase
5	2026-11-22T14:59:36Z	logout
6	2026-11-22T14:59:37Z	refund
nova tail -n 1 -f nova://demo/events
6	2026-11-22T14:59:37Z	refund
7	2026-11-22T14:59:42Z	review

The command prints the records from n before the tail up to the tail. When fewer than n records are still stored, it prints the ones there are. With --follow, it then keeps printing new records until you stop it. A scalable stream has no single tail, so the command fails there with nova: cluster: positions are per range on a scalable stream: ….

--limit, -nDefault10
How many of the last records to print
--follow, -fDefaultOff
Keep printing new records until you stop the command

The concept is Reads. The same task is Read the latest records with an SDK, and Read records with tail_offset over the API.

nova check-tail

Prints where the stream ends: the sequence number the next record will get, and the time of the last record, separated by a tab.

nova check-tail [options] <nova://bucket/key>

Check a stream

nova check-tail nova://demo/events
8	2026-11-22T14:59:42Z

The stream holds records 0 to 7, and the next append starts at 8.

Check an empty stream

A stream with no records prints 0 and time zero:

nova check-tail nova://demo/empty
0	1970-01-01T00:00:00Z

A stream that does not exist fails with nova: client: stream not found: … and exit code 1. On a scalable stream, the command prints the stream's bookmark, then one line per range with the range and its next sequence number. The command has no options of its own.

The concept is Reads. The same task is Check the tail with an SDK and Check the tail over the API.

nova stream trim

Removes every record before a sequence number or a time. The command is part of the stream group.

nova stream trim [options] <nova://bucket/key>

Trim by sequence number

nova stream trim nova://demo/events --entry 2
nova read nova://demo/events --limit 2
trimmed nova://demo/events below 2
2	2026-11-22T14:59:36Z	signup
3	2026-11-22T14:59:36Z	login

Trim by time, for a script

nova stream trim --output json nova://demo/events --at 2026-11-22T14:59:36Z
{
  "action": "trimmed",
  "address": "nova://demo/events",
  "before_timestamp_ms": 1795359576000
}

Trimmed records become unreadable at once, and Nova reclaims their storage later. The other records keep their sequence numbers. The trim point only moves forward: a point below the current one changes nothing, and a point past the tail removes every record. Give exactly one of --entry and --at. Otherwise the command fails with nova: stream trim: exactly one of -at or -entry is required.

--entryDefaultNone
Remove every record before this sequence number
--atDefaultNone
Remove every record stamped before this RFC 3339 time
--outputDefaulttext
json prints action, address, and before_seq_num or before_timestamp_ms

The concept is Trimming. The same task is Trim and delete with an SDK and Trim records over the API.

nova fence

Installs, replaces, or clears the stream's fencing token, and prints the position where the change took effect.

nova fence [options] <nova://bucket/key> [token]

Install a token

nova fence nova://demo/events writer-a
printf 'shipped\n' | nova append --fencing-token writer-a nova://demo/events
fenced "writer-a"	boundary 8
appended 1 entries

Replace the token

A new token fences out the writers that present the old one:

nova fence nova://demo/events writer-b
printf 'late\n' | nova append --fencing-token writer-a nova://demo/events
fenced "writer-b"	boundary 9
nova: client: fenced out: installed "writer-b": writer: open 01a203c5-062e-7622-825b-c09ea02dfc76 …

Clear the token

Leave out the token to clear it:

nova fence nova://demo/events
cleared	boundary 9

The boundary is the tail when the change took effect: every record before it was appended under the old token. A token holds at most 36 bytes of UTF-8. On a stream whose producer policy is any, an append without a token still succeeds. On a fenced stream, every append must present the installed token. On a scalable stream, the command prints the stream's bookmark, then one line per range. The command has no options of its own.

The concept is Writer coordination. The same task is Coordinate writers with an SDK and Fence a stream over the API.

On this page