Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow KV and Obj to specify placement options. #929

Merged
merged 1 commit into from Mar 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: would a stream info return the same user-provided-placement information provided here, or will the server alter that based on where the stream is placed?
The reason I ask is that for the v2.7.2/discard policy upgrade process done below, we do a reflect.DeepEqual() based on this stream config and the stream config we get from the js.StreamInfo() call.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is specified and the system can not accomodate it will fail.

I am adding in ability to "move" assets though now in server, but that update should be stamped etc so we should be good.

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