tstor/src/export/nfs/handler.go
2024-06-02 22:53:33 +03:00

29 lines
681 B
Go

package nfs
import (
"log/slog"
"time"
nfs "git.kmsign.ru/royalcat/tstor/pkg/go-nfs"
nfshelper "git.kmsign.ru/royalcat/tstor/pkg/go-nfs/helpers"
"git.kmsign.ru/royalcat/tstor/src/log"
"git.kmsign.ru/royalcat/tstor/src/vfs"
)
func NewNFSv3Handler(fs vfs.Filesystem) (nfs.Handler, error) {
nfslog := slog.With("component", "nfs")
nfs.SetLogger(log.NewNFSLog(nfslog))
nfs.Log.SetLevel(nfs.InfoLevel)
bfs := &fsWrapper{fs: fs, log: nfslog, timeout: time.Minute}
handler := nfshelper.NewNullAuthHandler(bfs)
cacheHelper, err := NewKvHandler(handler, bfs)
if err != nil {
return nil, err
}
// cacheHelper := NewCachingHandler(handler)
return cacheHelper, nil
}