-
Notifications
You must be signed in to change notification settings - Fork 786
Description
Proposed change
The nats.go jetstream.CreateObjectStore API should support creating mirrors and sourced object stores, which means adding Mirror *StreamSource and Sources []*StreamSource to ObjectStoreConfig.
Currently it requires a call to CreateStream with all the right options:
js.CreateStream(ctx, jetstream.StreamConfig{
Name: "OBJ_MYBUCKET",
Description: "Mirror of OBJ_MYBUCKET",
Mirror: &jetstream.StreamSource{
Name: "OBJ_MYBUCKET",
Domain: "myleafdomain"
},
Replicas: 1,
MaxAge: time.Hour * 24 * 14,
MaxBytes: -1,
Discard: jetstream.DiscardNew,
AllowRollup: true,
AllowDirect: true,
Storage: jetstream.FileStorage,
Compression: jetstream.S2Compression,
})The manual stream creations works great since #5106 was fixed, but first class support would align with KV and streams. Also, similar request is open for nats.js: nats-io/nats.js#155
Use case
We have leafnodes that write objects to a local object store bucket, and want those objects mirrored to an object store in the cluster. Ideally, we'd like a WorkStream style policy that removes them from the leafnode once mirrored, but for now we just use a short (~12hr) TTL on the leafnode and a longer (14 day) TTL for the cluster side mirror.
Contribution
No response