2024-05-05 20:23:07 +00:00
|
|
|
package fstree
|
2020-12-31 20:00:10 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"syscall"
|
|
|
|
|
|
|
|
"github.com/hanwen/go-fuse/v2/fs"
|
|
|
|
"github.com/hanwen/go-fuse/v2/fuse"
|
|
|
|
)
|
|
|
|
|
|
|
|
type refreshNode struct {
|
|
|
|
fs.Inode
|
2024-05-05 20:09:03 +00:00
|
|
|
ino uint64
|
|
|
|
|
|
|
|
source GroupSource
|
2020-12-31 20:00:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Ensure we are implementing the NodeSetattrer interface
|
|
|
|
var _ = (fs.NodeSetattrer)((*refreshNode)(nil))
|
|
|
|
|
|
|
|
// Ensure we are implementing the NodeOpener interface
|
|
|
|
var _ = (fs.NodeOpener)((*refreshNode)(nil))
|
|
|
|
|
2024-05-05 20:09:03 +00:00
|
|
|
func newRefreshNode(source GroupSource, param *FSParam) *refreshNode {
|
2020-12-31 20:00:10 +00:00
|
|
|
return &refreshNode{
|
2024-08-09 20:17:47 +00:00
|
|
|
ino: 0,
|
2024-05-05 20:09:03 +00:00
|
|
|
source: source,
|
2020-12-31 20:00:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *refreshNode) Ino() uint64 {
|
|
|
|
return n.ino
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *refreshNode) Mode() uint32 {
|
|
|
|
return fuse.S_IFREG
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *refreshNode) Setattr(ctx context.Context, fh fs.FileHandle, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *refreshNode) Open(ctx context.Context, flags uint32) (fh fs.FileHandle, fuseFlags uint32, errno syscall.Errno) {
|
2024-07-18 03:35:18 +00:00
|
|
|
n.source.InvalidateContentCache()
|
2020-12-31 20:00:10 +00:00
|
|
|
return nil, 0, 0
|
|
|
|
}
|