Esempio n. 1
0
}

var _ = fs.FS(benchFS{})

func (f benchFS) Root() (fs.Node, error) {
	return benchDir{conf: f.conf}, nil
}

type benchDir struct {
	conf *benchConfig
}

var _ = fs.Node(benchDir{})
var _ = fs.NodeStringLookuper(benchDir{})
var _ = fs.Handle(benchDir{})
var _ = fs.HandleReadDirAller(benchDir{})

func (benchDir) Attr(ctx context.Context, a *fuse.Attr) error {
	a.Inode = 1
	a.Mode = os.ModeDir | 0555
	return nil
}

func (d benchDir) Lookup(ctx context.Context, name string) (fs.Node, error) {
	if name == "bench" {
		return benchFile{conf: d.conf}, nil
	}
	return nil, fuse.ENOENT
}

func (benchDir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
Esempio n. 2
0
	for _, item := range items {
		if item.Name == path {
			child := &File{
				client: self.client,
				item:   item,
			}

			return child, nil
		}
	}

	return nil, fuse.ENOENT
}

var _ = fs.HandleReadDirAller(&Dir{})

func (d *Dir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
	/*prefix := ""
	if d.item != nil {
		prefix = d.item.Name
	}*/

	var res []fuse.Dirent

	items, err := d.client.List()

	if err != nil {
		return nil, err
	}