SaveToStorage saves the hard state, entries, and snapshot to persistent storage, in that order.
(h *raftpb.HardState, es []raftpb.Entry, s *raftpb.Snapshot)
| 278 | |
| 279 | // SaveToStorage saves the hard state, entries, and snapshot to persistent storage, in that order. |
| 280 | func (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. |