1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-16 00:04:40 +00:00

mount,vfs: unify Read and Write handles in preparation for ReadWrite handles

This commit is contained in:
Nick Craig-Wood
2017-11-02 18:22:26 +00:00
parent e18122e88b
commit 5634659ea3
6 changed files with 27 additions and 85 deletions

View File

@@ -102,6 +102,9 @@ type Handle interface {
Write(b []byte) (n int, err error)
WriteAt(b []byte, off int64) (n int, err error)
WriteString(s string) (n int, err error)
// Additional methods useful for FUSE filesystems
Flush() error
Release() error
}
// baseHandle implements all the missing methods
@@ -124,6 +127,8 @@ func (h baseHandle) Truncate(size int64) error { retu
func (h baseHandle) Write(b []byte) (n int, err error) { return 0, ENOSYS }
func (h baseHandle) WriteAt(b []byte, off int64) (n int, err error) { return 0, ENOSYS }
func (h baseHandle) WriteString(s string) (n int, err error) { return 0, ENOSYS }
func (h baseHandle) Flush() (err error) { return ENOSYS }
func (h baseHandle) Release() (err error) { return ENOSYS }
// Check interfaces
var (
@@ -131,7 +136,6 @@ var (
_ Handle = (*ReadFileHandle)(nil)
_ Handle = (*WriteFileHandle)(nil)
_ Handle = (*DirHandle)(nil)
_ Handle = (*os.File)(nil)
)
// VFS represents the top level filing system