func GetFS(c context.Context, whichType int) (fs fsi.FileSystem) { switch whichType { case 0: // re-instantiation would delete contents fs = fsi.FileSystem(memMapFileSys) case 1: // must be re-instantiated for each request dsFileSys := dsfs.New(dsfs.DirSort("byDateDesc"), dsfs.MountName("mntTest"), dsfs.AeContext(c)) fs = fsi.FileSystem(dsFileSys) case 2: osFileSys := osfs.New(osfs.DirSort("byDateDesc")) fs = fsi.FileSystem(osFileSys) os.Chdir(logDir) default: panic("invalid whichType ") } return }
// GetFS instantiates a filesystem, depending on whichtype func GetFS(c context.Context) (fs fsi.FileSystem) { switch whichType { case 0: // must be re-instantiated for each request docRoot = "" dsFileSys := dsfs.New(dsfs.DirSort("byDateDesc"), dsfs.MountName(mountName), dsfs.AeContext(c)) fs = fsi.FileSystem(dsFileSys) case 1: docRoot = "c:/docroot/" os.Chdir(docRoot) osFileSys := osfs.New(osfs.DirSort("byDateDesc")) fs = fsi.FileSystem(osFileSys) case 2: // re-instantiation would delete contents docRoot = "" fs = fsi.FileSystem(memMapFileSys) default: panic("invalid whichType ") } return }