-
Notifications
You must be signed in to change notification settings - Fork 325
/
policies.go
79 lines (75 loc) · 4.45 KB
/
policies.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package utils
const (
FirstBoundary string = "0x00000000"
LastBoundary string = "0xffffffff"
)
type Policies struct {
Bundles *BundlesData `json:"bundles"`
Persistence *PersistencePolicies `json:"persistence"`
RetentionPolicies *RetentionPolicies `json:"retention_policies"`
SchemaValidationEnforced bool `json:"schema_validation_enforced"`
DeduplicationEnabled *bool `json:"deduplicationEnabled"`
Deleted bool `json:"deleted"`
EncryptionRequired bool `json:"encryption_required"`
MessageTTLInSeconds *int `json:"message_ttl_in_seconds"`
MaxProducersPerTopic *int `json:"max_producers_per_topic"`
MaxConsumersPerTopic *int `json:"max_consumers_per_topic"`
MaxConsumersPerSubscription *int `json:"max_consumers_per_subscription"`
CompactionThreshold *int64 `json:"compaction_threshold"`
OffloadThreshold int64 `json:"offload_threshold"`
OffloadDeletionLagMs *int64 `json:"offload_deletion_lag_ms"`
AntiAffinityGroup string `json:"antiAffinityGroup"`
ReplicationClusters []string `json:"replication_clusters"`
LatencyStatsSampleRate map[string]int `json:"latency_stats_sample_rate"`
BacklogQuotaMap map[BacklogQuotaType]BacklogQuota `json:"backlog_quota_map"`
TopicDispatchRate map[string]DispatchRate `json:"topicDispatchRate"`
SubscriptionDispatchRate map[string]DispatchRate `json:"subscriptionDispatchRate"`
ReplicatorDispatchRate map[string]DispatchRate `json:"replicatorDispatchRate"`
PublishMaxMessageRate map[string]PublishRate `json:"publishMaxMessageRate"`
ClusterSubscribeRate map[string]SubscribeRate `json:"clusterSubscribeRate"`
TopicAutoCreationConfig *TopicAutoCreationConfig `json:"autoTopicCreationOverride"`
SchemaCompatibilityStrategy SchemaCompatibilityStrategy `json:"schema_auto_update_compatibility_strategy"`
AuthPolicies AuthPolicies `json:"auth_policies"`
SubscriptionAuthMode SubscriptionAuthMode `json:"subscription_auth_mode"`
IsAllowAutoUpdateSchema *bool `json:"is_allow_auto_update_schema"`
}
func NewDefaultPolicies() *Policies {
return &Policies{
AuthPolicies: *NewAuthPolicies(),
ReplicationClusters: make([]string, 0, 10),
BacklogQuotaMap: make(map[BacklogQuotaType]BacklogQuota),
TopicDispatchRate: make(map[string]DispatchRate),
SubscriptionDispatchRate: make(map[string]DispatchRate),
ReplicatorDispatchRate: make(map[string]DispatchRate),
PublishMaxMessageRate: make(map[string]PublishRate),
ClusterSubscribeRate: make(map[string]SubscribeRate),
LatencyStatsSampleRate: make(map[string]int),
MessageTTLInSeconds: nil,
Deleted: false,
EncryptionRequired: false,
SubscriptionAuthMode: None,
MaxProducersPerTopic: nil,
MaxConsumersPerSubscription: nil,
MaxConsumersPerTopic: nil,
CompactionThreshold: nil,
OffloadThreshold: -1,
SchemaCompatibilityStrategy: Full,
SchemaValidationEnforced: false,
}
}