2018-07-21 11:35:31 +00:00
|
|
|
package s3
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
// Mounter interface which can be implemented
|
|
|
|
// by the different mounter types
|
|
|
|
type Mounter interface {
|
|
|
|
Format() error
|
|
|
|
Mount(targetPath string) error
|
2018-07-21 13:23:11 +00:00
|
|
|
Unmount(targetPath string) error
|
2018-07-21 11:35:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const (
|
|
|
|
s3fsMounterType = "s3fs"
|
|
|
|
goofysMounterType = "goofys"
|
|
|
|
s3qlMounterType = "s3ql"
|
|
|
|
)
|
|
|
|
|
|
|
|
// newMounter returns a new mounter depending on the mounterType parameter
|
2018-07-21 13:23:11 +00:00
|
|
|
func newMounter(bucket string, cfg *Config) (Mounter, error) {
|
|
|
|
switch cfg.Mounter {
|
2018-07-21 11:35:31 +00:00
|
|
|
case s3fsMounterType:
|
|
|
|
return newS3fsMounter(bucket, cfg)
|
|
|
|
|
|
|
|
case goofysMounterType:
|
|
|
|
return newGoofysMounter(bucket, cfg)
|
|
|
|
|
|
|
|
case s3qlMounterType:
|
|
|
|
return newS3qlMounter(bucket, cfg)
|
|
|
|
|
|
|
|
}
|
2018-07-21 13:23:11 +00:00
|
|
|
return nil, fmt.Errorf("Error mounting bucket %s, invalid mounter specified: %s", bucket, cfg.Mounter)
|
2018-07-21 11:35:31 +00:00
|
|
|
}
|