MCPcopy
hub / github.com/dgraph-io/dgraph / commitWithTs

Function commitWithTs

dgraph/cmd/alpha/http_test.go:338–365  ·  view source on GitHub ↗
(mr mutationResponse, abort bool)

Source from the content-addressed store, hash-verified

336}
337
338func commitWithTs(mr mutationResponse, abort bool) error {
339 url := addr + "/commit"
340 if mr.startTs != 0 {
341 url += "?startTs=" + strconv.FormatUint(mr.startTs, 10)
342 url += "&hash=" + mr.hash
343 }
344 if abort {
345 if mr.startTs != 0 {
346 url += "&abort=true"
347 } else {
348 url += "?abort=true"
349 }
350 }
351
352 m := make(map[string]interface{})
353 m["keys"] = mr.keys
354 m["preds"] = mr.preds
355 b, err := json.Marshal(m)
356 if err != nil {
357 return err
358 }
359 req, err := http.NewRequest("POST", url, bytes.NewReader(b))
360 if err != nil {
361 return err
362 }
363 _, _, _, err = runRequest(req)
364 return err
365}
366
367func commitWithTsKeysOnly(keys []string, ts uint64, hash string) error {
368 url := addr + "/commit"

Callers 5

TestMetricTxnCommitsFunction · 0.85
TestMetricTxnDiscardsFunction · 0.85
TestMetricTxnAbortsFunction · 0.85
TestTransactionBasicFunction · 0.85

Calls 1

runRequestFunction · 0.85

Tested by

no test coverage detected