MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / SaveToStorage

Method SaveToStorage

conn/node.go:280–288  ·  view source on GitHub ↗

SaveToStorage saves the hard state, entries, and snapshot to persistent storage, in that order.

(h *raftpb.HardState, es []raftpb.Entry, s *raftpb.Snapshot)

Source from the content-addressed store, hash-verified

278
279// SaveToStorage saves the hard state, entries, and snapshot to persistent storage, in that order.
280func (n *Node) SaveToStorage(h *raftpb.HardState, es []raftpb.Entry, s *raftpb.Snapshot) {
281 for {
282 if err := n.Store.Save(h, es, s); err != nil {
283 glog.Errorf("While trying to save Raft update: %v. Retrying...", err)
284 } else {
285 return
286 }
287 }
288}
289
290// PastLife returns the index of the snapshot before the restart (if any) and whether there was
291// a previous state that should be recovered after a restart.

Callers 3

runMethod · 0.95
RunMethod · 0.80
RunMethod · 0.80

Calls 2

SaveMethod · 0.45
ErrorfMethod · 0.45

Tested by 1

runMethod · 0.76