diff --git a/contrib/cbconfig/cbconfig.go b/contrib/cbconfig/cbconfig.go index 325d655..2891f83 100644 --- a/contrib/cbconfig/cbconfig.go +++ b/contrib/cbconfig/cbconfig.go @@ -1,5 +1,7 @@ package cbconfig +import "slices" + type VBucketServerMapJson struct { HashAlgorithm string `json:"hashAlgorithm"` NumReplicas int `json:"numReplicas"` @@ -7,6 +9,17 @@ type VBucketServerMapJson struct { VBucketMap [][]int `json:"vBucketMap,omitempty"` } +// TODO - have this take pointer args and handle the nil case +func (vbMap VBucketServerMapJson) Equal(otherMap VBucketServerMapJson) bool { + for i, vb := range vbMap.VBucketMap { + if !slices.Equal(vb, otherMap.VBucketMap[i]) { + return false + } + } + + return slices.Equal(vbMap.ServerList, otherMap.ServerList) +} + type ConfigDDocsJson struct { URI string `json:"uri,omitempty"` }