142
refreshDuration dynamicconfig.DurationPropertyFn,
143
logger log.Logger,
145
>
if len(clusterInfo) == 0 {
146
panic("Empty cluster information")
147
>
} else if len(masterClusterName) == 0 {
metadata.go
148
panic("Master cluster name is empty")
149
>
} else if len(currentClusterName) == 0 {
metadata.go
150
panic("Current cluster name is empty")
151
>
} else if failoverVersionIncrement == 0 || failoverVersionIncrement > math.MaxInt32 {
metadata.go
152
panic("Version increment <= 0 or > 2147483647")
153
}
154
155
>
versionToClusterName, err := updateVersionToClusterName(clusterInfo, failoverVersionIncrement)
metadata.go
156
>
if err != nil {
157
// nolint:forbidigo // matches the other startup-config panics in this constructor
158
panic(err.Error())
159
}
160
>
if _, ok := clusterInfo[currentClusterName]; !ok {
metadata.go
161
panic("Current cluster is not specified in cluster info")
162
}
163
>
if _, ok := clusterInfo[masterClusterName]; !ok {
metadata.go
164
panic("Master cluster is not specified in cluster info")
165
}
166
167
>
copyClusterInfo := make(map[string]ClusterInformation)
metadata.go
168
>
maps.Copy(copyClusterInfo, clusterInfo)
169
>
if refreshDuration == nil {
170
refreshDuration = dynamicconfig.GetDurationPropertyFn(refreshInterval)
171
}
173
>
status: common.DaemonStatusInitialized,
174
>
enableGlobalNamespace: enableGlobalNamespace,
175
>
failoverVersionIncrement: failoverVersionIncrement,
176
>
masterClusterName: masterClusterName,
177
>
currentClusterName: currentClusterName,
178
>
clusterInfo: copyClusterInfo,
179
>
versionToClusterName: versionToClusterName,
180
>
clusterChangeCallback: make(map[any]CallbackFn),
181
>
clusterMetadataStore: clusterMetadataStore,
182
>
logger: logger,
183
>
refreshDuration: refreshDuration,
184
>
}
185
}
186