added custom buffer size error handling

This commit is contained in:
ston1th 2022-03-30 17:06:56 +02:00
commit 711f020c18
4 changed files with 123 additions and 10 deletions

View file

@ -30,6 +30,7 @@ var (
listenCache string
quota int64
max int
bs int
log logr.Logger
)
@ -45,12 +46,17 @@ func main() {
flag.StringVar(&listenWebdav, "webdav", "", "listen addr:port for webdav")
flag.StringVar(&listenCache, "cache", "", "listen addr:port for cache only")
flag.IntVar(&max, "max", -1, "max parallel preloads")
flag.IntVar(&bs, "bs", -1, "tune reload buffer size in bytes (default: 8192)")
flag.Int64Var(&quota, "quota", 1, "max disk usage quota in GiB")
flag.Parse()
log = klogr.New().WithName("main")
log.Info("starting cachefs", "version", version)
if fs.SetBufferSize(bs) {
log.V(2).Info("changed preload buffer size", "size", bs)
}
filesystem, err := fs.NewFS(quota*gib, max, src, dst, metadata, klogr.New().WithName("fs"))
if err != nil {
klog.Fatalf("init failed: %s", err)