var errBadWALName … // Exist returns true if there are any files in a given directory. func Exist(dir string) bool { … } // searchIndex returns the last array index of names whose raft index section is // equal to or smaller than the given index. // The given names MUST be sorted. func searchIndex(lg *zap.Logger, names []string, index uint64) (int, bool) { … } // names should have been sorted based on sequence number. // isValidSeq checks whether seq increases continuously. func isValidSeq(lg *zap.Logger, names []string) bool { … } func readWALNames(lg *zap.Logger, dirpath string) ([]string, error) { … } func checkWalNames(lg *zap.Logger, names []string) []string { … } func parseWALName(str string) (seq, index uint64, err error) { … } func walName(seq, index uint64) string { … }