Buckets

Buckets

A bucket is a named group of streams that gives each new stream its default settings.

A bucket is a named group of streams. Every stream belongs to exactly one bucket, which must exist before the stream does. The bucket gives each new stream its default settings, and decides whether an append or a read can create a missing stream. This bucket creates its streams on their first append, and gives them seven days of retention:

GET /v1/buckets/apps
{
  "name": "apps",
  "location": "local",
  "create_stream_on_append": true,
  "create_stream_on_read": false,
  "default_class": "standard",
  "default_producer_policy": "any",
  "default_retention_max_age_ms": 604800000,
  "default_timestamping_mode": "client-prefer",
  "created_at_unix_ms": 1795372238240
}

Use buckets to group streams that share settings and permissions: one bucket per application, per environment, or per tenant. Model your data shows how to choose. You create and change buckets from an SDK, the API, or the nova bucket commands.

Names and keys

A bucket's name is unique in the cluster. It holds 3 to 63 bytes of lowercase letters, digits, and hyphens, and does not start or end with a hyphen. Nova has no built-in buckets: even a bucket named default must be created.

A stream's key is its name inside the bucket: 1 to 512 bytes of UTF-8, without control characters. A slash is an ordinary character of the name: Nova has no folders. orders, orders/, and orders/eu are three separate streams, and creating orders/eu creates nothing else. You can list a bucket's streams by key prefix, so a convention such as tenant/orders/id makes related streams easy to find. A key cannot be renamed.

Over HTTP, a key is one percent-encoded path segment: orders/eu becomes /v1/streams/apps/orders%2Feu.

Address and ID

A stream's address is its bucket and key, written nova://apps/orders/eu. Every call names a stream by its address. Nova also gives each stream a permanent ID, which appears in responses and logs. When two requests create the same address at the same time, one creates the stream and the other fails with 409.

When you delete a stream and create it again at the same address, you get a new stream: a new ID, an empty history, and sequence numbers from 0.

Default stream settings

A new stream copies each setting its create request leaves out from the bucket's defaults: class, producer policy, timestamping, retention, and throughput. A bucket created without defaults gets Nova's: Standard class, the any producer policy, client-prefer timestamping, and no retention or throughput limit.

The copy happens once, at creation. Changing a bucket's defaults affects streams created afterwards. Existing streams keep their settings until you reconfigure them. Settings lists every field and when a change applies.

An update replaces every setting

Updating a bucket replaces all its settings at once. A default you leave out of the update goes back to Nova's built-in value. Read the bucket first and send every setting back.

Create on first use

With create_stream_on_append, an append to a missing stream in the bucket creates it with the bucket's defaults. Appends that arrive at the same time all write to the one stream they create. This suits applications that make new keys all the time, such as one stream per device or session. With create_stream_on_read, a read or subscription can create an empty stream too, so a reader can start waiting before the first writer arrives.

Other calls never create a stream. A tail check, a fence, or a trim on a missing stream fails with 404. Without these settings, so do appends and reads.

A bucket can be deleted only when it holds no streams.

Location

Each bucket records the location of the cluster that created it, such as eu-west-1, and keeps it for life. A client configured with a location sends it when it creates or updates a bucket. If the cluster serves another location, the call fails with 400, so a bucket never lands in a region you did not mean. The operator sets the cluster's location; see the novad reference.

See also

On this page