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

Method newLog

kayak/log.go:30–53  ·  view source on GitHub ↗
(ctx context.Context, logType kt.LogType, data []byte)

Source from the content-addressed store, hash-verified

28)
29
30func (r *Runtime) newLog(ctx context.Context, logType kt.LogType, data []byte) (l *kt.Log, err error) {
31 defer trace.StartRegion(ctx, "newWAL").End()
32
33 // allocate index
34 r.nextIndexLock.Lock()
35 i := r.nextIndex
36 r.nextIndex++
37 r.nextIndexLock.Unlock()
38 l = &kt.Log{
39 LogHeader: kt.LogHeader{
40 Index: i,
41 Type: logType,
42 Producer: r.nodeID,
43 },
44 Data: data,
45 }
46
47 // error write will be a fatal error, cause to node to fail fast
48 if err = r.wal.Write(l); err != nil {
49 log.Fatalf("WRITE LOG FAILED: %v", err)
50 }
51
52 return
53}
54
55func (r *Runtime) writeWAL(ctx context.Context, l *kt.Log) (err error) {
56 defer trace.StartRegion(ctx, "writeWal").End()

Callers 3

leaderDoCommitMethod · 0.95
leaderLogPrepareMethod · 0.95
leaderLogRollbackMethod · 0.95

Calls 4

StartRegionFunction · 0.92
FatalfMethod · 0.80
WriteMethod · 0.65
EndMethod · 0.45

Tested by

no test coverage detected