import ( "sync" "sync/atomic" "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/bazil.org/fuse" "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/bazil.org/fuse/fs" "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/golang.org/x/net/context" ) // Writes gathers data from FUSE Write calls. type Writes struct { buf Buffer } var _ = fs.HandleWriter(&Writes{}) func (w *Writes) Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) error { n, err := w.buf.Write(req.Data) resp.Size = n if err != nil { return err } return nil } func (w *Writes) RecordedWriteData() []byte { return w.buf.Bytes() } // Counter records number of times a thing has occurred.
l := []fuse.Dirent{ {Inode: 2, Name: "bench", Type: fuse.DT_File}, } return l, nil } type benchFile struct { conf *benchConfig } var _ = fs.Node(benchFile{}) var _ = fs.NodeOpener(benchFile{}) var _ = fs.NodeFsyncer(benchFile{}) var _ = fs.Handle(benchFile{}) var _ = fs.HandleReader(benchFile{}) var _ = fs.HandleWriter(benchFile{}) func (benchFile) Attr(ctx context.Context, a *fuse.Attr) error { a.Inode = 2 a.Mode = 0644 a.Size = 9999999999999999 return nil } func (f benchFile) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fs.Handle, error) { if f.conf.directIO { resp.Flags |= fuse.OpenDirectIO } // TODO configurable? resp.Flags |= fuse.OpenKeepCache return f, nil