Added FUSE support #55

Merged
Elara6331 merged 65 commits from yannickulrich/itd:fuse into master 2023-03-25 22:23:52 +00:00
Showing only changes of commit 4d3bc1ed40 - Show all commits

View File

@ -1,6 +1,7 @@
package main package main
import ( import (
"go.arsenm.dev/logger"
"go.arsenm.dev/logger/log" "go.arsenm.dev/logger/log"
"os" "os"
"context" "context"
@ -241,7 +242,7 @@ type bytesFileWriteHandle struct {
var _ = (fs.FileWriter)((*bytesFileWriteHandle)(nil)) var _ = (fs.FileWriter)((*bytesFileWriteHandle)(nil))
func (fh *bytesFileWriteHandle) Write(ctx context.Context, data []byte, off int64) (written uint32, errno syscall.Errno) { func (fh *bytesFileWriteHandle) Write(ctx context.Context, data []byte, off int64) (written uint32, errno syscall.Errno) {
log.Info("Executing Write").Str("path", fh.path).Int("size", len(fh.content)).Send() log.Info("Executing Write").Str("path", fh.path).Int("prev_size", len(fh.content)).Int("next_size", len(data)).Send()
if off != int64(len(fh.content)) { if off != int64(len(fh.content)) {
} }
fh.content = append(fh.content[:], data[:]...) fh.content = append(fh.content[:], data[:]...)
@ -483,6 +484,11 @@ func (f *ITNode) Rmdir(ctx context.Context, name string) syscall.Errno {
return f.Unlink(ctx, name) return f.Unlink(ctx, name)
} }
func init() {
// Default logger is JSONLogger going to stderr
log.Logger = logger.NewPretty(os.Stdout)
}
func main() { func main() {
// This is where we'll mount the FS // This is where we'll mount the FS
mntDir := "/tmp/x" mntDir := "/tmp/x"