github.com/grailbio/base@v0.0.11/file/filebench/s3fuse/main.go (about) 1 package main 2 3 import ( 4 "os" 5 6 "github.com/grailbio/base/file" 7 "github.com/grailbio/base/file/fsnodefuse" 8 "github.com/grailbio/base/file/gfilefs" 9 "github.com/grailbio/base/file/s3file" 10 "github.com/grailbio/base/must" 11 "github.com/hanwen/go-fuse/v2/fs" 12 "github.com/hanwen/go-fuse/v2/fuse" 13 ) 14 15 func main() { 16 mount := os.Args[1] 17 file.RegisterImplementation("s3", func() file.Implementation { 18 return s3file.NewImplementation(s3file.NewDefaultProvider(), s3file.Options{}) 19 }) 20 root := fsnodefuse.NewRoot(gfilefs.New("s3://", "s3")) 21 mountOpts := fuse.MountOptions{FsName: "s3"} 22 fsnodefuse.ConfigureDefaultMountOptions(&mountOpts) 23 fsnodefuse.ConfigureRequiredMountOptions(&mountOpts) 24 server, err := fs.Mount(mount, root, &fs.Options{MountOptions: mountOpts}) 25 must.Nil(err) 26 server.Wait() 27 }