file controller

This commit is contained in:
royalcat 2024-07-09 00:19:04 +03:00
parent 199a82ff0c
commit 0371af3344
21 changed files with 440 additions and 280 deletions
src/export/nfs

View file

@ -49,7 +49,8 @@ var kvhandlerMeter = otel.Meter("git.kmsign.ru/royalcat/tstor/src/export/nfs.kvh
// NewKvHandler provides a basic to/from-file handle cache that can be tuned with a smaller cache of active directory listings.
func NewKvHandler(h nfs.Handler, fs nfs.Filesystem, config config.NFS) (nfs.Handler, error) {
opts := kvbadger.DefaultOptions(path.Join(config.CachePath, "handlers"))
opts := kvbadger.DefaultOptions[handle](path.Join(config.CachePath, "handlers"))
opts.Codec = kv.CodecBinary[handle, *handle]{}
opts.BadgerOptions.Logger = log.BadgerLogger("nfs", "kvhandler")
activeHandles, err := kvbadger.NewBagerKVBinaryKey[uuid.UUID, handle](opts)