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

Method handleGetCheckpoint

db/blip_handler.go:214–237  ·  view source on GitHub ↗

CHECKPOINTS Received a "getCheckpoint" request

(rq *blip.Message)

Source from the content-addressed store, hash-verified

212
213// Received a "getCheckpoint" request
214func (bh *blipHandler) handleGetCheckpoint(rq *blip.Message) error {
215
216 client := rq.Properties[BlipClient]
217 bh.logEndpointEntry(rq.Profile(), fmt.Sprintf("Client:%s", client))
218
219 response := rq.Response()
220 if response == nil {
221 return nil
222 }
223
224 value, err := bh.collection.GetSpecial(DocTypeLocal, CheckpointDocIDPrefix+client)
225 if err != nil {
226 return err
227 }
228 if value == nil {
229 return base.NewHTTPError(http.StatusNotFound, http.StatusText(http.StatusNotFound))
230 }
231 response.Properties[GetCheckpointResponseRev] = value[BodyRev].(string)
232 delete(value, BodyRev)
233 delete(value, BodyId)
234 // TODO: Marshaling here when we could use raw bytes all the way from the bucket
235 _ = response.SetJSONBody(value)
236 return nil
237}
238
239// Received a "setCheckpoint" request
240func (bh *blipHandler) handleSetCheckpoint(rq *blip.Message) error {

Callers

nothing calls this directly

Calls 4

logEndpointEntryMethod · 0.95
NewHTTPErrorFunction · 0.92
GetSpecialMethod · 0.80
ResponseMethod · 0.45

Tested by

no test coverage detected