This commit is contained in:
Alex Yatskov 2015-05-10 17:08:04 +09:00
parent b328e58e6f
commit 903bc4a145
2 changed files with 14 additions and 13 deletions

View File

@ -2,22 +2,14 @@
package main package main
import ( import (
"flag"
"fmt"
"os"
"bazil.org/fuse" "bazil.org/fuse"
"bazil.org/fuse/fs" "bazil.org/fuse/fs"
_ "bazil.org/fuse/fs/fstestutil" // "flag"
// "fmt"
"golang.org/x/net/context" "golang.org/x/net/context"
"os"
) )
var Usage = func() {
fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
fmt.Fprintf(os.Stderr, " %s MOUNTPOINT\n", os.Args[0])
flag.PrintDefaults()
}
// func main() { // func main() {
// flag.Usage = Usage // flag.Usage = Usage
// flag.Parse() // flag.Parse()
@ -68,6 +60,7 @@ func (Dir) Attr(a *fuse.Attr) {
} }
func (Dir) Lookup(ctx context.Context, name string) (fs.Node, error) { func (Dir) Lookup(ctx context.Context, name string) (fs.Node, error) {
if name == "hello" { if name == "hello" {
return File{}, nil return File{}, nil
} }

View File

@ -60,12 +60,16 @@ func newVersion(base string, parent *version) (*version, error) {
return nil, err return nil, err
} }
version := &version{ ver := &version{
base: base, base: base,
parent: parent, parent: parent,
timestamp: time.Unix(timeval, 0)} timestamp: time.Unix(timeval, 0)}
return version, nil if err := ver.loadMetadata(); err != nil {
return nil, err
}
return ver, nil
} }
func (this *version) loadMetadata() error { func (this *version) loadMetadata() error {
@ -98,3 +102,7 @@ func (this *version) saveMetadata() error {
func (this *version) metadataPath() string { func (this *version) metadataPath() string {
return filepath.Join(this.base, "meta.json") return filepath.Join(this.base, "meta.json")
} }
func (this *version) rootPath() string {
return filepath.Join(this.base, "root")
}