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

feat: support the namespace offloadThresholdInSeconds API in pulsaradmin pkg #1271

Merged
merged 5 commits into from
Aug 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions pulsaradmin/pkg/admin/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ type Namespaces interface {
// GetOffloadThreshold returns the offloadThreshold for a namespace
GetOffloadThreshold(namespace utils.NameSpaceName) (int64, error)

// SetOffloadThreshold sets the offloadThresholdInSeconds for a namespace
ericsyh marked this conversation as resolved.
Show resolved Hide resolved
SetOffloadThresholdInSeconds(namespace utils.NameSpaceName, threshold int64) error

// GetOffloadThreshold returns the offloadThresholdInSeconds for a namespace
ericsyh marked this conversation as resolved.
Show resolved Hide resolved
GetOffloadThresholdInSeconds(namespace utils.NameSpaceName) (int64, error)

// SetCompactionThreshold sets the compactionThreshold for a namespace
SetCompactionThreshold(namespace utils.NameSpaceName, threshold int64) error

Expand Down Expand Up @@ -551,6 +557,18 @@ func (n *namespaces) GetOffloadThreshold(namespace utils.NameSpaceName) (int64,
return result, err
}

func (n *namespaces) SetOffloadThresholdInSeconds(namespace utils.NameSpaceName, threshold int64) error {
endpoint := n.pulsar.endpoint(n.basePath, namespace.String(), "offloadThresholdInSeconds")
return n.pulsar.Client.Put(endpoint, threshold)
}

func (n *namespaces) GetOffloadThresholdInSeconds(namespace utils.NameSpaceName) (int64, error) {
var result int64
endpoint := n.pulsar.endpoint(n.basePath, namespace.String(), "offloadThresholdInSeconds")
err := n.pulsar.Client.Get(endpoint, &result)
return result, err
}

func (n *namespaces) SetMaxConsumersPerTopic(namespace utils.NameSpaceName, max int) error {
endpoint := n.pulsar.endpoint(n.basePath, namespace.String(), "maxConsumersPerTopic")
return n.pulsar.Client.Post(endpoint, max)
Expand Down