Documentation
¶
Index ¶
- func Patch(ctx context.Context, fsys fs.FS, name string, tarBuf bytes.Buffer) error
- type Cacher
- func (fsys *Cacher) CacheNode(node *Node)
- func (fsys *Cacher) CacheNodeError(path string, err error)
- func (fsys *Cacher) CachedNode(path string) (*Node, error, bool)
- func (fsys *Cacher) Chmod(name string, mode fs.FileMode) error
- func (fsys *Cacher) ChmodContext(ctx context.Context, name string, mode fs.FileMode) error
- func (fsys *Cacher) Chown(name string, uid, gid int) error
- func (fsys *Cacher) ChownContect(ctx context.Context, name string, uid, gid int) error
- func (fsys *Cacher) Chtimes(name string, atime time.Time, mtime time.Time) error
- func (fsys *Cacher) ChtimesContext(ctx context.Context, name string, atime time.Time, mtime time.Time) error
- func (fsys *Cacher) Create(name string) (fs.File, error)
- func (fsys *Cacher) CreateContext(ctx context.Context, name string, content []byte, mode fs.FileMode) (fs.File, error)
- func (fsys *Cacher) GetTTL() time.Duration
- func (fsys *Cacher) InvalidateAll(name string)
- func (fsys *Cacher) InvalidateNode(path string, resync, recursive bool) error
- func (fsys *Cacher) Mkdir(name string, perm fs.FileMode) error
- func (fsys *Cacher) MkdirContext(ctx context.Context, name string, perm fs.FileMode) error
- func (fsys *Cacher) Open(name string) (fs.File, error)
- func (fsys *Cacher) OpenContext(ctx context.Context, name string) (fs.File, error)
- func (fsys *Cacher) Patch(ctx context.Context, name string, tarBuf bytes.Buffer) error
- func (fsys *Cacher) PullDir(ctx context.Context, name string) (*Node, error)
- func (fsys *Cacher) PullMeta(ctx context.Context, path string) (*Node, error)
- func (fsys *Cacher) PullNode(ctx context.Context, name string, recursivePrefetch bool) (*Node, []byte, error)
- func (fsys *Cacher) ReadDir(name string) ([]fs.DirEntry, error)
- func (fsys *Cacher) ReadDirContext(ctx context.Context, name string) ([]fs.DirEntry, error)
- func (fsys *Cacher) Readlink(name string) (string, error)
- func (fsys *Cacher) ReadlinkContext(ctx context.Context, name string) (string, error)
- func (fsys *Cacher) Remove(name string) error
- func (fsys *Cacher) RemoveContext(ctx context.Context, name string) error
- func (fsys *Cacher) Rename(oldname, newname string) error
- func (fsys *Cacher) RenameContext(ctx context.Context, oldname, newname string) error
- func (fsys *Cacher) SetTTL(ttl time.Duration)
- func (fsys *Cacher) Stat(name string) (fs.FileInfo, error)
- func (fsys *Cacher) StatContext(ctx context.Context, name string) (fs.FileInfo, error)
- func (fsys *Cacher) Symlink(oldname, newname string) error
- func (fsys *Cacher) SymlinkContext(ctx context.Context, oldname, newname string) error
- func (fsys *Cacher) WriteFile(name string, data []byte, perm fs.FileMode) error
- func (fsys *Cacher) WriteFileContext(ctx context.Context, name string, data []byte, perm fs.FileMode, ...) error
- type FS
- func (fsys *FS) Chmod(name string, mode fs.FileMode) error
- func (fsys *FS) ChmodContext(ctx context.Context, name string, mode fs.FileMode) error
- func (fsys *FS) Chown(name string, uid, gid int) error
- func (fsys *FS) ChownContect(ctx context.Context, name string, uid, gid int) error
- func (fsys *FS) Chtimes(name string, atime time.Time, mtime time.Time) error
- func (fsys *FS) ChtimesContext(ctx context.Context, name string, atime time.Time, mtime time.Time) error
- func (fsys *FS) Create(name string) (fs.File, error)
- func (fsys *FS) CreateContext(ctx context.Context, name string, content []byte, mode fs.FileMode) (fs.File, error)
- func (fsys *FS) Ignore(names ...string)
- func (fsys *FS) Index(ctx context.Context, name string) (fs.FS, error)
- func (fsys *FS) Mkdir(name string, perm fs.FileMode) error
- func (fsys *FS) MkdirContext(ctx context.Context, name string, perm fs.FileMode) error
- func (fsys *FS) Open(name string) (fs.File, error)
- func (fsys *FS) OpenContext(ctx context.Context, name string) (fs.File, error)
- func (fsys *FS) Patch(ctx context.Context, name string, tarBuf bytes.Buffer) error
- func (fsys *FS) ReadDir(name string) ([]fs.DirEntry, error)
- func (fsys *FS) ReadDirContext(ctx context.Context, name string) ([]fs.DirEntry, error)
- func (fsys *FS) ReadFile(name string) ([]byte, error)
- func (fsys *FS) ReadFileContext(ctx context.Context, name string) ([]byte, error)
- func (fsys *FS) Readlink(name string) (string, error)
- func (fsys *FS) ReadlinkContext(ctx context.Context, name string) (string, error)
- func (fsys *FS) Remove(name string) error
- func (fsys *FS) RemoveContext(ctx context.Context, name string) error
- func (fsys *FS) Rename(oldname, newname string) error
- func (fsys *FS) RenameContext(ctx context.Context, oldname, newname string) error
- func (fsys *FS) SetLogger(logger *slog.Logger)
- func (fsys *FS) Stat(name string) (fs.FileInfo, error)
- func (fsys *FS) StatContext(ctx context.Context, name string) (fs.FileInfo, error)
- func (fsys *FS) Symlink(oldname, newname string) error
- func (fsys *FS) SymlinkContext(ctx context.Context, oldname, newname string) error
- func (fsys *FS) WriteFile(name string, data []byte, perm fs.FileMode) error
- func (fsys *FS) WriteFileContext(ctx context.Context, name string, data []byte, perm fs.FileMode, ...) error
- type Node
- func (n *Node) Close() error
- func (n *Node) Entries() []fs.DirEntry
- func (n *Node) Info() (fs.FileInfo, error)
- func (n *Node) IsDir() bool
- func (n *Node) ModTime() time.Time
- func (n *Node) Mode() fs.FileMode
- func (n *Node) Name() string
- func (n *Node) Path() string
- func (n *Node) Read(p []byte) (int, error)
- func (n *Node) ReadDir(count int) ([]fs.DirEntry, error)
- func (n *Node) Seek(offset int64, whence int) (int64, error)
- func (n *Node) Size() int64
- func (n *Node) Stat() (fs.FileInfo, error)
- func (n *Node) Sys() interface{}
- func (n *Node) ToNode() *fskit.Node
- func (n *Node) Type() fs.FileMode
- func (f *Node) Write(p []byte) (int, error)
- type PatchFS
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cacher ¶
type Cacher struct {
// contains filtered or unexported fields
}
Cacher wraps an FS and adds caching functionality
func (*Cacher) CacheNodeError ¶
CacheNodeError stores node request error in cache
func (*Cacher) CachedNode ¶
CachedNode retrieves cached node result if valid
func (*Cacher) ChmodContext ¶
ChmodContext changes file mode with context
func (*Cacher) ChownContect ¶
ChownContect changes ownership with context
func (*Cacher) ChtimesContext ¶
func (fsys *Cacher) ChtimesContext(ctx context.Context, name string, atime time.Time, mtime time.Time) error
ChtimesContext changes times with context
func (*Cacher) CreateContext ¶
func (fsys *Cacher) CreateContext(ctx context.Context, name string, content []byte, mode fs.FileMode) (fs.File, error)
CreateContext is a helper for creating files with content and mode
func (*Cacher) InvalidateAll ¶
InvalidateAll clears all cached node results
func (*Cacher) InvalidateNode ¶
InvalidateNode invalidates a node in the cache
func (*Cacher) MkdirContext ¶
MkdirContext creates a directory with context
func (*Cacher) OpenContext ¶
OpenContext opens the named file for reading with context
func (*Cacher) PullDir ¶
PullDir gets metadata for a directory and its entries using multipart response. Called async on cache lookup w/ renewal, called sync on cache invalidate w/ resync. Called sync on StatContext w/ cache miss.
func (*Cacher) PullMeta ¶
PullMeta performs a HEAD request to get metadata. Called async on cache lookup w/ renewal, called sync on StatContext w/ cache miss.
func (*Cacher) PullNode ¶
func (fsys *Cacher) PullNode(ctx context.Context, name string, recursivePrefetch bool) (*Node, []byte, error)
PullNode fetches and caches a node with optional subtree prefetching Called by Open and ReadDir on cache miss.
func (*Cacher) ReadDirContext ¶
ReadDirContext reads the named directory with context
func (*Cacher) ReadlinkContext ¶
ReadlinkContext reads the value of a symbolic link with context
func (*Cacher) RemoveContext ¶
RemoveContext removes a file or directory with context
func (*Cacher) RenameContext ¶
RenameContext renames a file or directory with context
func (*Cacher) StatContext ¶
StatContext performs a HEAD request to get file metadata if not cached
func (*Cacher) SymlinkContext ¶
SymlinkContext creates a symbolic link with context
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
FS implements an HTTP-backed filesystem following the design specification
func (*FS) ChmodContext ¶
ChmodContext changes file mode with context
func (*FS) ChownContect ¶
ChownContect changes ownership with context
func (*FS) ChtimesContext ¶
func (fsys *FS) ChtimesContext(ctx context.Context, name string, atime time.Time, mtime time.Time) error
ChtimesContext changes times with context
func (*FS) CreateContext ¶
func (fsys *FS) CreateContext(ctx context.Context, name string, content []byte, mode fs.FileMode) (fs.File, error)
CreateContext is a helper for creating files with content and mode
func (*FS) MkdirContext ¶
MkdirContext creates a directory with context
func (*FS) OpenContext ¶
OpenContext opens the named file for reading with context
func (*FS) ReadDirContext ¶
ReadDirContext reads the named directory with context
func (*FS) ReadFileContext ¶
func (*FS) ReadlinkContext ¶
func (*FS) RemoveContext ¶
RemoveContext removes a file or directory with context
func (*FS) RenameContext ¶
func (*FS) StatContext ¶
StatContext performs a HEAD request to get file metadata
func (*FS) SymlinkContext ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node represents a file or directory node
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements an HTTP server that serves an fs.FS using the httpfs protocol
func NewServerWithPrefix ¶
NewServerWithPrefix creates a new HTTP server with a URL prefix