backend

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(t Type, f Factory)

Register registers a backend factory for the given type.

Types

type Backend

type Backend interface {
	// Mount starts the FUSE filesystem. Blocks until unmount.
	// onReady is called once the kernel mount is confirmed live.
	Mount(ctx context.Context, onReady func()) error

	// Unmount gracefully unmounts the filesystem.
	Unmount() error

	// ForceUnmount attempts platform-specific force unmount.
	ForceUnmount() error

	// Type returns the backend type.
	Type() Type
}

Backend abstracts FUSE mount/unmount operations.

func Create

func Create(t Type, cfg Config) (Backend, error)

Create creates a backend of the given type.

type Config

type Config struct {
	MountPoint    string
	NzbFs         *nzbfilesystem.NzbFilesystem
	FuseConfig    config.FuseConfig
	StreamTracker StreamTracker
	UID           uint32
	GID           uint32
}

Config holds parameters common to all backends.

type Factory

type Factory func(cfg Config) (Backend, error)

Factory creates a Backend from a Config.

type Refresher

type Refresher interface {
	RefreshDirectory(name string)
}

Refresher is optionally implemented by backends that support kernel cache invalidation (e.g. hanwen via NotifyContent/NotifyEntry).

type StreamTracker

type StreamTracker interface {
	AddStream(filePath, source, userName, clientIP, userAgent string, totalSize int64) *nzbfilesystem.ActiveStream
	UpdateProgress(id string, bytesRead int64)
	Remove(id string)
}

StreamTracker is the subset of stream tracking needed by FUSE backends.

type Type

type Type string

Type identifies a FUSE backend implementation.

const (
	Hanwen Type = "hanwen"
	Cgo    Type = "cgo"
)

func DefaultType

func DefaultType() Type

DefaultType returns the platform-default backend type. Linux uses hanwen (pure Go). macOS uses cgo (Fuse-T). Windows FUSE support via WinFsp requires a native Windows build; cross-compiled Windows binaries default to cgo but FUSE mounting is not supported without WinFsp. Override with ALTMOUNT_FUSE_BACKEND env var (checked by caller).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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