]> git.r.bdr.sh - rbdr/mobius/blobdiff - hotline/file_store.go
Buffer file writes during upload
[rbdr/mobius] / hotline / file_store.go
index e9d083f6b0a8af29354d224c6f8557fc427c22f2..ed0ffa492448cc05b5fec976005af9aee1936870 100644 (file)
@@ -13,6 +13,7 @@ type FileStore interface {
        Open(name string) (*os.File, error)
        Symlink(oldname, newname string) error
        Remove(name string) error
        Open(name string) (*os.File, error)
        Symlink(oldname, newname string) error
        Remove(name string) error
+       Create(name string) (*os.File, error)
        // TODO: implement these
        // Rename(oldpath string, newpath string) error
        // RemoveAll(path string) error
        // TODO: implement these
        // Rename(oldpath string, newpath string) error
        // RemoveAll(path string) error
@@ -40,6 +41,10 @@ func (fs *OSFileStore) Remove(name string) error {
        return os.Remove(name)
 }
 
        return os.Remove(name)
 }
 
+func (fs *OSFileStore) Create(name string) (*os.File, error) {
+       return os.Create(name)
+}
+
 type MockFileStore struct {
        mock.Mock
 }
 type MockFileStore struct {
        mock.Mock
 }
@@ -72,3 +77,8 @@ func (mfs *MockFileStore) Remove(name string) error {
        args := mfs.Called(name)
        return args.Error(0)
 }
        args := mfs.Called(name)
        return args.Error(0)
 }
+
+func (mfs *MockFileStore) Create(name string) (*os.File, error) {
+       args := mfs.Called(name)
+       return args.Get(0).(*os.File), args.Error(1)
+}