NewFileSystem
parent
2fe7597c4e
commit
e1375f33da
|
@ -14,7 +14,10 @@
|
|||
|
||||
package flushfs
|
||||
|
||||
import "github.com/jacobsa/fuse"
|
||||
import (
|
||||
"github.com/jacobsa/fuse"
|
||||
"github.com/jacobsa/fuse/fuseutil"
|
||||
)
|
||||
|
||||
// Create a file system containing a single file named "foo".
|
||||
//
|
||||
|
@ -23,4 +26,11 @@ import "github.com/jacobsa/fuse"
|
|||
// called with the current contents of the file.
|
||||
func NewFileSystem(
|
||||
reportFlush func(string),
|
||||
reportFsync func(string)) (fs fuse.FileSystem, err error)
|
||||
reportFsync func(string)) (fs fuse.FileSystem, err error) {
|
||||
fs = &flushFS{}
|
||||
return
|
||||
}
|
||||
|
||||
type flushFS struct {
|
||||
fuseutil.NotImplementedFileSystem
|
||||
}
|
||||
|
|
|
@ -44,6 +44,8 @@ type FlushFSTest struct {
|
|||
func init() { RegisterTestSuite(&FlushFSTest{}) }
|
||||
|
||||
func (t *FlushFSTest) SetUp(ti *TestInfo) {
|
||||
var err error
|
||||
|
||||
// Set up a file system.
|
||||
reportTo := func(slice *[]string) func(string) {
|
||||
return func(s string) {
|
||||
|
@ -53,9 +55,16 @@ func (t *FlushFSTest) SetUp(ti *TestInfo) {
|
|||
}
|
||||
}
|
||||
|
||||
t.FileSystem = flushfs.NewFileSystem(
|
||||
t.FileSystem, err = flushfs.NewFileSystem(
|
||||
reportTo(&t.flushes),
|
||||
reportTo(&t.fsyncs))
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// Mount it.
|
||||
t.SampleTest.SetUp(ti)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue