code: func (n *Node) saveToStorage(
  	ctx context.Context,
  	raftConfig *api.RaftConfig,
  	hardState raftpb.HardState,
  	entries []raftpb.Entry,
  	snapshot raftpb.Snapshot,
  ) (err error) {
  
  	if !raft.IsEmptySnap(snapshot) {
  		if err := n.raftLogger.SaveSnapshot(snapshot); err != nil {
  			return errors.Wrap(err, "failed to save snapshot")
  		}
  		if err := n.raftLogger.GC(snapshot.Metadata.Index, snapshot.Metadata.Term, raftConfig.KeepOldSnapshots); err != nil {
  			log.G(ctx).WithError(err).Error("unable to clean old snapshots and WALs")
  		}
  		if err = n.raftStore.ApplySnapshot(snapshot); err != nil {
  			return errors.Wrap(err, "failed to apply snapshot on raft node")
  		}
  	}
  
  	if err := n.raftLogger.SaveEntries(hardState, entries); err != nil {
  		return errors.Wrap(err, "failed to save raft log entries")
  	}
  
  	if len(entries) > 0 {
  		lastIndex := entries[len(entries)-1].Index
  		if lastIndex > n.writtenWALIndex {
  			n.writtenWALIndex = lastIndex
  		}
  	}
  
  	if err = n.raftStore.Append(entries); err != nil {
  		return errors.Wrap(err, "failed to append raft log entries")
  	}
  
  	return nil
  }
docs: // Saves a log entry to our Store