Skip to content

Commit

Permalink
Allow KV and Obj to specifiy placement
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Collison <derek@nats.io>
  • Loading branch information
derekcollison committed Mar 16, 2022
1 parent 77460b8 commit 3b8c93b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions kv.go
Expand Up @@ -188,6 +188,7 @@ type KeyValueConfig struct {
MaxBytes int64
Storage StorageType
Replicas int
Placement *Placement
}

// Used to watch all keys.
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion 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
Expand Down Expand Up @@ -138,6 +138,7 @@ type ObjectStoreConfig struct {
TTL time.Duration
Storage StorageType
Replicas int
Placement *Placement
}

type ObjectStoreStatus interface {
Expand Down Expand Up @@ -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,
}
Expand Down

0 comments on commit 3b8c93b

Please sign in to comment.