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

Method Fetch

kayak/runtime.go:332–360  ·  view source on GitHub ↗

Fetch defines entry for missing log startFetch.

(ctx context.Context, index uint64)

Source from the content-addressed store, hash-verified

330
331// Fetch defines entry for missing log startFetch.
332func (r *Runtime) Fetch(ctx context.Context, index uint64) (l *kt.Log, err error) {
333 if atomic.LoadUint32(&r.started) != 1 {
334 err = kt.ErrStopped
335 return
336 }
337
338 tm := timer.NewTimer()
339
340 defer func() {
341 log.WithField("l", index).
342 WithFields(tm.ToLogFields()).
343 WithError(err).
344 Debug("kayak log startFetch")
345 }()
346
347 r.peersLock.RLock()
348 defer r.peersLock.RUnlock()
349
350 tm.Add("peers_lock")
351
352 if r.role != proto.Leader {
353 // not leader
354 err = kt.ErrNotLeader
355 return
356 }
357
358 // wal get
359 return r.wal.Get(index)
360}
361
362// FollowerApply defines entry for follower node.
363func (r *Runtime) FollowerApply(l *kt.Log) (err error) {

Callers

nothing calls this directly

Calls 8

ToLogFieldsMethod · 0.95
AddMethod · 0.95
NewTimerFunction · 0.92
WithFieldFunction · 0.92
DebugMethod · 0.80
WithErrorMethod · 0.80
WithFieldsMethod · 0.80
GetMethod · 0.65

Tested by

no test coverage detected