fusego/samples/memfs/file.go

37 lines
827 B
Go
Raw Normal View History

2015-02-27 08:32:01 +03:00
// Copyright 2015 Google Inc. All Rights Reserved.
// Author: jacobsa@google.com (Aaron Jacobs)
package memfs
import (
2015-03-02 06:00:48 +03:00
"errors"
2015-02-27 08:32:01 +03:00
"sync"
"github.com/jacobsa/fuse"
)
type memFile struct {
/////////////////////////
// Constant data
/////////////////////////
inode fuse.InodeID
/////////////////////////
// Mutable state
/////////////////////////
mu sync.RWMutex
// The current contents of the file.
contents []byte // GUARDED_BY(mu)
}
// TODO(jacobsa): Add a test that various WriteAt calls with a real on-disk
// file to verify what the behavior should be here, particularly when starting
// a write well beyond EOF. Leave the test around for documentation purposes.
2015-03-02 06:00:48 +03:00
func (f *memFile) WriteAt(p []byte, off int64) (n int, err error) {
err = errors.New("TODO(jacobsa): Implement memFile.WriteAt.")
return
}