mirror of
https://github.com/minio/minio.git
synced 2025-11-27 04:46:53 -05:00
Use errorChannels only for services not for drivers, reduce them to use simple functions
This commit is contained in:
@@ -29,22 +29,14 @@ type fsDriver struct {
|
||||
multiparts *Multiparts
|
||||
}
|
||||
|
||||
// Start filesystem channel
|
||||
func Start(root string) (chan<- string, <-chan error, drivers.Driver) {
|
||||
ctrlChannel := make(chan string)
|
||||
errorChannel := make(chan error)
|
||||
// NewDriver instantiate a new filesystem driver
|
||||
func NewDriver(root string) (drivers.Driver, error) {
|
||||
fs := new(fsDriver)
|
||||
fs.root = root
|
||||
fs.lock = new(sync.Mutex)
|
||||
// internal related to multiparts
|
||||
fs.multiparts = new(Multiparts)
|
||||
fs.multiparts.ActiveSession = make(map[string]*MultipartSession)
|
||||
go start(ctrlChannel, errorChannel, fs)
|
||||
return ctrlChannel, errorChannel, fs
|
||||
}
|
||||
|
||||
func start(ctrlChannel <-chan string, errorChannel chan<- error, fs *fsDriver) {
|
||||
err := os.MkdirAll(fs.root, 0700)
|
||||
errorChannel <- err
|
||||
close(errorChannel)
|
||||
return fs, err
|
||||
}
|
||||
|
||||
@@ -38,7 +38,8 @@ func (s *MySuite) TestAPISuite(c *C) {
|
||||
path, err := ioutil.TempDir(os.TempDir(), "minio-fs-")
|
||||
c.Check(err, IsNil)
|
||||
storageList = append(storageList, path)
|
||||
_, _, store := Start(path)
|
||||
store, err := NewDriver(path)
|
||||
c.Check(err, IsNil)
|
||||
return store
|
||||
}
|
||||
drivers.APITestSuite(c, create)
|
||||
|
||||
Reference in New Issue
Block a user