MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / leaderCommitResult

Method leaderCommitResult

kayak/commit.go:32–59  ·  view source on GitHub ↗
(ctx context.Context, tm *timer.Timer, reqPayload interface{}, prepareLog *kt.Log)

Source from the content-addressed store, hash-verified

30)
31
32func (r *Runtime) leaderCommitResult(ctx context.Context, tm *timer.Timer, reqPayload interface{}, prepareLog *kt.Log) (res *commitFuture) {
33 defer trace.StartRegion(ctx, "leaderCommitResult").End()
34
35 // decode log and send to commit channel to process
36 res = newCommitFuture()
37
38 if prepareLog == nil {
39 res.Set(&commitResult{err: errors.Wrap(kt.ErrInvalidLog, "nil prepare log in commit")})
40 return
41 }
42
43 // decode prepare log
44 req := &commitReq{
45 ctx: ctx,
46 data: reqPayload,
47 index: prepareLog.Index,
48 result: res,
49 tm: tm,
50 }
51
52 select {
53 case <-ctx.Done():
54 res = nil
55 case r.commitCh <- req:
56 }
57
58 return
59}
60
61func (r *Runtime) followerCommitResult(ctx context.Context, tm *timer.Timer, commitLog *kt.Log, prepareLog *kt.Log, lastCommit uint64) (res *commitFuture) {
62 defer trace.StartRegion(ctx, "followerCommitResult").End()

Callers 1

doLeaderCommitMethod · 0.95

Calls 4

StartRegionFunction · 0.92
newCommitFutureFunction · 0.85
EndMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected