helpers

package
v0.0.0-...-8b65fed Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2025 License: GPL-3.0, Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCachingHandler

func NewCachingHandler(h nfs.Handler, limit int) nfs.Handler

NewCachingHandler wraps a handler to provide a basic to/from-file handle cache.

func NewCachingHandlerWithVerifierLimit

func NewCachingHandlerWithVerifierLimit(h nfs.Handler, limit int, verifierLimit int) nfs.Handler

NewCachingHandlerWithVerifierLimit provides a basic to/from-file handle cache that can be tuned with a smaller cache of active directory listings.

func NewNullAuthHandler

func NewNullAuthHandler(fs nfs.Filesystem) nfs.Handler

NewNullAuthHandler creates a handler for the provided filesystem

func WrapBillyFS

func WrapBillyFS(bf billy.Filesystem) nfs.Filesystem

func WrapFile

func WrapFile(bf billy.File) nfs.File

Types

type CachingHandler

type CachingHandler struct {
	nfs.Handler
	// contains filtered or unexported fields
}

CachingHandler implements to/from handle via an LRU cache.

func (*CachingHandler) DataForVerifier

func (c *CachingHandler) DataForVerifier(path string, id uint64) []fs.FileInfo

func (*CachingHandler) FromHandle

func (c *CachingHandler) FromHandle(ctx context.Context, fh []byte) (nfs.Filesystem, []string, error)

FromHandle converts from an opaque handle to the file it represents

func (*CachingHandler) HandleLimit

func (c *CachingHandler) HandleLimit() int

HandleLimit exports how many file handles can be safely stored by this cache.

func (*CachingHandler) InvalidateHandle

func (c *CachingHandler) InvalidateHandle(ctx context.Context, fs nfs.Filesystem, handle []byte) error

func (*CachingHandler) ToHandle

func (c *CachingHandler) ToHandle(ctx context.Context, f nfs.Filesystem, path []string) []byte

ToHandle takes a file and represents it with an opaque handle to reference it. In stateless nfs (when it's serving a unix fs) this can be the device + inode but we can generalize with a stateful local cache of handed out IDs.

func (*CachingHandler) VerifierFor

func (c *CachingHandler) VerifierFor(path string, contents []fs.FileInfo) uint64

type NullAuthHandler

type NullAuthHandler struct {
	// contains filtered or unexported fields
}

NullAuthHandler returns a NFS backing that exposes a given file system in response to all mount requests.

func (*NullAuthHandler) Change

func (h *NullAuthHandler) Change(fs nfs.Filesystem) nfs.Change

Change provides an interface for updating file attributes.

func (*NullAuthHandler) FSStat

FSStat provides information about a filesystem.

func (*NullAuthHandler) FromHandle

func (h *NullAuthHandler) FromHandle(context.Context, []byte) (nfs.Filesystem, []string, error)

FromHandle handled by CachingHandler

func (*NullAuthHandler) HandleLimit

func (h *NullAuthHandler) HandleLimit() int

HandleLImit handled by cachingHandler

func (*NullAuthHandler) InvalidateHandle

func (c *NullAuthHandler) InvalidateHandle(context.Context, nfs.Filesystem, []byte) error

func (*NullAuthHandler) Mount

func (h *NullAuthHandler) Mount(ctx context.Context, conn net.Conn, req nfs.MountRequest) (status nfs.MountStatus, hndl nfs.Filesystem, auths []nfs.AuthFlavor)

Mount backs Mount RPC Requests, allowing for access control policies.

func (*NullAuthHandler) ToHandle

ToHandle handled by CachingHandler

Directories

Path Synopsis
Package memfs is a variant of "github.com/go-git/go-billy/v5/memfs" with stable mtimes for items.
Package memfs is a variant of "github.com/go-git/go-billy/v5/memfs" with stable mtimes for items.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL