MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / ctx

Method ctx

rest/handler.go:210–224  ·  view source on GitHub ↗

ctx returns the request-scoped context for logging/cancellation.

()

Source from the content-addressed store, hash-verified

208
209// ctx returns the request-scoped context for logging/cancellation.
210func (h *handler) ctx() context.Context {
211 if h.rqCtx == nil {
212 serverAddr, err := h.getServerAddr()
213 if err != nil {
214 base.AssertfCtx(h.rq.Context(), "Error getting server address: %v", err)
215 }
216 ctx := base.RequestLogCtx(h.rq.Context(), base.RequestData{
217 CorrelationID: h.formatSerialNumber(),
218 RequestHost: serverAddr,
219 RequestRemoteAddr: h.rq.RemoteAddr,
220 })
221 h.rqCtx = ctx
222 }
223 return h.rqCtx
224}
225
226func (h *handler) getServerAddr() (string, error) {
227 return h.server.getServerAddr(h.serverType)

Callers 15

handleGetDocChannelsMethod · 0.95
handleSyncFnDryRunMethod · 0.95
handleAllDbsMethod · 0.95
handleGetCompactMethod · 0.95
handleCompactMethod · 0.95
handleFlushMethod · 0.95
handleGetResyncMethod · 0.95
handlePostResyncMethod · 0.95
handlePostUpgradeMethod · 0.95

Calls 5

getServerAddrMethod · 0.95
formatSerialNumberMethod · 0.95
AssertfCtxFunction · 0.92
RequestLogCtxFunction · 0.92
ContextMethod · 0.65

Tested by

no test coverage detected