MCPcopy Create free account
hub / github.com/couchbase/cbft / ServeHTTP

Method ServeHTTP

rest_options.go:160–204  ·  view source on GitHub ↗
(
	w http.ResponseWriter, req *http.Request)

Source from the content-addressed store, hash-verified

158}
159
160func (h *ConciseOptions) ServeHTTP(
161 w http.ResponseWriter, req *http.Request) {
162 maxReplicasAllowed, _ := strconv.Atoi(h.mgr.Options()["maxReplicasAllowed"])
163 bucketTypesAllowed := h.mgr.Options()["bucketTypesAllowed"]
164 hideUI := h.mgr.Options()["hideUI"]
165 vbuckets, _ := strconv.Atoi(h.mgr.Options()["vbuckets"])
166 bleveMaxResultWindow, _ := strconv.Atoi(h.mgr.Options()["bleveMaxResultWindow"])
167 bleveMaxClauseCount, _ := strconv.Atoi(h.mgr.Options()["bleveMaxClauseCount"])
168 if bleveMaxClauseCount == 0 {
169 // in case bleveMaxClauseCount wasn't updated by user
170 bleveMaxClauseCount = DefaultBleveMaxClauseCount
171 }
172
173 var collectionsSupported bool
174 if versionTracker != nil &&
175 versionTracker.clusterCompatibleForVersion(FeatureCollectionVersion) {
176 if nodeDefs, _, err := cbgt.CfgGetNodeDefs(
177 h.mgr.Cfg(), cbgt.NODE_DEFS_WANTED); err == nil {
178 if cbgt.IsFeatureSupportedByCluster(FeatureCollections, nodeDefs) {
179 collectionsSupported = true
180 }
181 }
182 }
183
184 rv := struct {
185 Status string `json:"status"`
186 MaxReplicasAllowed int `json:"maxReplicasAllowed"`
187 BucketTypesAllowed string `json:"bucketTypesAllowed"`
188 HideUI string `json:"hideUI"`
189 VBuckets int `json:"vbuckets"`
190 CollectionsSupport bool `json:"collectionsSupport"`
191 BleveMaxResultWindow int `json:"bleveMaxResultWindow"`
192 BleveMaxClauseCount int `json:"bleveMaxClauseCount"`
193 }{
194 Status: "ok",
195 MaxReplicasAllowed: maxReplicasAllowed,
196 BucketTypesAllowed: bucketTypesAllowed,
197 HideUI: hideUI,
198 VBuckets: vbuckets,
199 CollectionsSupport: collectionsSupported,
200 BleveMaxResultWindow: bleveMaxResultWindow,
201 BleveMaxClauseCount: bleveMaxClauseCount,
202 }
203 rest.MustEncode(w, rv)
204}

Callers 1

ServeHTTPMethod · 0.45

Calls 1

Tested by

no test coverage detected