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

Function handleAbort

dgraph/cmd/alpha/http.go:560–579  ·  view source on GitHub ↗
(ctx context.Context, startTs uint64, hash string)

Source from the content-addressed store, hash-verified

558}
559
560func handleAbort(ctx context.Context, startTs uint64, hash string) (map[string]interface{}, error) {
561 tc := &api.TxnContext{
562 StartTs: startTs,
563 Aborted: true,
564 Hash: hash,
565 }
566
567 tctx, err := (&edgraph.Server{}).CommitOrAbort(ctx, tc)
568 switch {
569 case tctx.Aborted:
570 return map[string]interface{}{
571 "code": x.Success,
572 "message": "Done",
573 }, nil
574 case err == nil:
575 return nil, errors.Errorf("transaction could not be aborted")
576 default:
577 return nil, err
578 }
579}
580
581func handleCommit(ctx context.Context,
582 startTs uint64, hash string, reqText []byte) (map[string]interface{}, error) {

Callers 1

commitHandlerFunction · 0.85

Calls 2

CommitOrAbortMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected