etcdserver/backend.go
func openSnapshotBackend(cfg ServerConfig, ss *snap.Snapshotter, snapshot raftpb.Snapshot) (backend.Backend, error) {
	snapPath, err := ss.DBFilePath(snapshot.Metadata.Index)
	if err != nil {
		return nil, fmt.Errorf("failed to find database snapshot file (%v)", err)
	}
	if err := os.Rename(snapPath, cfg.backendPath()); err != nil {
		return nil, fmt.Errorf("failed to rename database snapshot file (%v)", err)
	}
	return openBackend(cfg), nil
}
func openSnapshotBackend(cfg ServerConfig, ss *snap.Snapshotter, snapshot raftpb.Snapshot) (backend.Backend, error) {
	snapPath, err := ss.DBFilePath(snapshot.Metadata.Index)
	if err != nil {
		return nil, fmt.Errorf("failed to find database snapshot file (%v)", err)
	}
	if err := os.Rename(snapPath, cfg.backendPath()); err != nil {
		return nil, fmt.Errorf("failed to rename database snapshot file (%v)", err)
	}
	return openBackend(cfg), nil
}
func openSnapshotBackend ( cfg ServerConfig , ss * snap . Snapshotter , snapshot raftpb . Snapshot ) ( backend . Backend , error ) { snapPath , err := ss . DBFilePath ( snapshot . Metadata . Index ) if err != nil { return nil , fmt . Errorf ( " " , err ) } if err := os . Rename ( snapPath , cfg . backendPath ( ) ) ; err != nil { return nil , fmt . Errorf ( " " , err ) } return openBackend ( cfg ) , nil }
// openSnapshotBackend renames a snapshot db to the current etcd db and opens it.
openSnapshotBackend renames a snapshot db to the current etcd db and opens it .