mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-04-24 18:59:34 +08:00
33 lines
608 B
Go
33 lines
608 B
Go
package mount
|
|
|
|
import (
|
|
"context"
|
|
"syscall"
|
|
|
|
"github.com/hanwen/go-fuse/v2/fs"
|
|
"github.com/hanwen/go-fuse/v2/fuse"
|
|
)
|
|
|
|
type WeedFS struct {
|
|
fs.Inode
|
|
}
|
|
|
|
func (r *WeedFS) OnAdd(ctx context.Context) {
|
|
ch := r.NewPersistentInode(
|
|
ctx, &fs.MemRegularFile{
|
|
Data: []byte("file.txt"),
|
|
Attr: fuse.Attr{
|
|
Mode: 0644,
|
|
},
|
|
}, fs.StableAttr{Ino: 2})
|
|
r.AddChild("file.txt", ch, false)
|
|
}
|
|
|
|
func (r *WeedFS) Getattr(ctx context.Context, fh fs.FileHandle, out *fuse.AttrOut) syscall.Errno {
|
|
out.Mode = 0755
|
|
return 0
|
|
}
|
|
|
|
var _ = (fs.NodeGetattrer)((*WeedFS)(nil))
|
|
var _ = (fs.NodeOnAdder)((*WeedFS)(nil))
|