etcdserver/api/snap/snapshotter.go
func (s *Snapshotter) snapNames() ([]string, error) {
	dir, err := os.Open(s.dir)
	if err != nil {
		return nil, err
	}
	defer dir.Close()
	names, err := dir.Readdirnames(-1)
	if err != nil {
		return nil, err
	}
	snaps := checkSuffix(s.lg, names)
	if len(snaps) == 0 {
		return nil, ErrNoSnapshot
	}
	sort.Sort(sort.Reverse(sort.StringSlice(snaps)))
	return snaps, nil
}
func (s *Snapshotter) snapNames() ([]string, error) {
	dir, err := os.Open(s.dir)
	if err != nil {
		return nil, err
	}
	defer dir.Close()
	names, err := dir.Readdirnames(-1)
	if err != nil {
		return nil, err
	}
	snaps := checkSuffix(s.lg, names)
	if len(snaps) == 0 {
		return nil, ErrNoSnapshot
	}
	sort.Sort(sort.Reverse(sort.StringSlice(snaps)))
	return snaps, nil
}
func ( s * Snapshotter ) snapNames ( ) ( [ ] string , error ) { dir , err := os . Open ( s . dir ) if err != nil { return nil , err } defer dir . Close ( ) names , err := dir . Readdirnames ( - 1 ) if err != nil { return nil , err } snaps := checkSuffix ( s . lg , names ) if len ( snaps ) == 0 { return nil , ErrNoSnapshot } sort . Sort ( sort . Reverse ( sort . StringSlice ( snaps ) ) ) return snaps , nil }
// snapNames returns the filename of the snapshots in logical time order (from newest to oldest).
// If there is no available snapshots, an ErrNoSnapshot will be returned.
snapNames returns the filename of the snapshots in logical time order ( from newest to oldest ) . If there is no available snapshots an ErrNoSnapshot will be returned .