diff --git a/src/NATS.Client.KeyValueStore/NatsKVConfig.cs b/src/NATS.Client.KeyValueStore/NatsKVConfig.cs index 3ff86e67d..ac4432819 100644 --- a/src/NATS.Client.KeyValueStore/NatsKVConfig.cs +++ b/src/NATS.Client.KeyValueStore/NatsKVConfig.cs @@ -58,6 +58,11 @@ public record NatsKVConfig /// public NatsKVRepublish? Republish { get; init; } + /// + /// Placement requirements for a key-value store stream. + /// + public Placement? Placement { get; init; } + /// /// Use compressed storage. /// diff --git a/src/NATS.Client.KeyValueStore/NatsKVContext.cs b/src/NATS.Client.KeyValueStore/NatsKVContext.cs index 501a261aa..9cbbdbc6b 100644 --- a/src/NATS.Client.KeyValueStore/NatsKVContext.cs +++ b/src/NATS.Client.KeyValueStore/NatsKVContext.cs @@ -223,6 +223,7 @@ private static StreamConfig CreateStreamConfig(NatsKVConfig config) Compression = config.Compression ? StreamConfigCompression.S2 : StreamConfigCompression.None, Storage = storage, Republish = republish!, + Placement = config.Placement, AllowRollupHdrs = true, DenyDelete = true, DenyPurge = false, diff --git a/src/NATS.Client.ObjectStore/NatsObjConfig.cs b/src/NATS.Client.ObjectStore/NatsObjConfig.cs index 9df981fbb..bef5d7d03 100644 --- a/src/NATS.Client.ObjectStore/NatsObjConfig.cs +++ b/src/NATS.Client.ObjectStore/NatsObjConfig.cs @@ -1,3 +1,5 @@ +using NATS.Client.JetStream.Models; + namespace NATS.Client.ObjectStore; /// @@ -40,6 +42,11 @@ public record NatsObjConfig(string Bucket) /// public int NumberOfReplicas { get; init; } = 1; + /// + /// Placement requirements for a object store stream. + /// + public Placement? Placement { get; init; } + /// /// Additional metadata for the bucket. /// diff --git a/src/NATS.Client.ObjectStore/NatsObjContext.cs b/src/NATS.Client.ObjectStore/NatsObjContext.cs index 969239e17..61c23a8f3 100644 --- a/src/NATS.Client.ObjectStore/NatsObjContext.cs +++ b/src/NATS.Client.ObjectStore/NatsObjContext.cs @@ -43,7 +43,7 @@ public async ValueTask CreateObjectStoreAsync(NatsObjConfig confi MaxBytes = config.MaxBytes ?? -1, Storage = storage, NumReplicas = config.NumberOfReplicas, - /* TODO: Placement = */ + Placement = config.Placement, Discard = StreamConfigDiscard.New, AllowRollupHdrs = true, AllowDirect = true,