From 3b8c93b4f8b806ff00feff5410202f1f3c4258cf Mon Sep 17 00:00:00 2001 From: Derek Collison Date: Wed, 16 Mar 2022 14:00:53 -0700 Subject: [PATCH] Allow KV and Obj to specifiy placement Signed-off-by: Derek Collison --- kv.go | 2 ++ object.go | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/kv.go b/kv.go index da33774e8..24a771d96 100644 --- a/kv.go +++ b/kv.go @@ -188,6 +188,7 @@ type KeyValueConfig struct { MaxBytes int64 Storage StorageType Replicas int + Placement *Placement } // Used to watch all keys. @@ -347,6 +348,7 @@ func (js *js) CreateKeyValue(cfg *KeyValueConfig) (KeyValue, error) { MaxMsgSize: maxMsgSize, Storage: cfg.Storage, Replicas: replicas, + Placement: cfg.Placement, AllowRollup: true, DenyDelete: true, Duplicates: 2 * time.Minute, diff --git a/object.go b/object.go index 4de788bce..94d9a4eaa 100644 --- a/object.go +++ b/object.go @@ -1,4 +1,4 @@ -// Copyright 2021 The NATS Authors +// Copyright 2021-2022 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -138,6 +138,7 @@ type ObjectStoreConfig struct { TTL time.Duration Storage StorageType Replicas int + Placement *Placement } type ObjectStoreStatus interface { @@ -245,6 +246,7 @@ func (js *js) CreateObjectStore(cfg *ObjectStoreConfig) (ObjectStore, error) { MaxAge: cfg.TTL, Storage: cfg.Storage, Replicas: cfg.Replicas, + Placement: cfg.Placement, Discard: DiscardNew, AllowRollup: true, }