Help us shape the future of Go! Take the 2026 Go Developer Survey

service

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: BSD-3-Clause Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMountNotFound     = errors.New("mount not found")
	ErrMountIDConflict   = errors.New("mount ID is already in use")
	ErrMountPathConflict = errors.New("mount path is already in use")
	ErrMountLimitReached = errors.New("maximum number of mounts reached")
	ErrDAVFSLazyUnmount  = errors.New("DAVFS was lazily unmounted with cache data preserved")
)

Functions

This section is empty.

Types

type Metrics

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

Metrics owns a dedicated Prometheus registry (not the global default registry), so multiple Services in one process — as in tests — never fight over duplicate registrations.

func NewMetrics

func NewMetrics(manager *MountManager) *Metrics

NewMetrics creates and registers irodsfsd's Prometheus metrics, including a live collector for irodsfsd_mounts backed by manager's current state.

func (*Metrics) Handler

func (metrics *Metrics) Handler() http.Handler

Handler returns the http.Handler that serves this registry's metrics in the Prometheus exposition format.

type MountManager

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

MountManager owns irodsfs processes, system mount commands, and their in-memory state.

func NewMountManager

func NewMountManager(config *irodsfsd_commons.Config, repository *store.MountRepository) (*MountManager, error)

NewMountManager validates FUSE and constructs a process manager. Mount intent and state transitions are persisted through repository so they survive a daemon restart.

func (*MountManager) GetMount

func (manager *MountManager) GetMount(ctx context.Context, mountID string) (*api.MountInfo, error)

GetMount returns one redacted mount snapshot.

func (*MountManager) ListMounts

func (manager *MountManager) ListMounts(ctx context.Context, request *api.ListMountsRequest) ([]*api.MountInfo, error)

ListMounts returns redacted snapshots matching all supplied filters.

func (*MountManager) Mount

func (manager *MountManager) Mount(ctx context.Context, request *api.MountRequest) (result *api.MountInfo, err error)

Mount starts the selected mount client. irodsfs runs in foreground mode and receives its JSON configuration through stdin; DAVFS and NFS use one-shot system mount commands.

func (*MountManager) Ready

func (manager *MountManager) Ready(ctx context.Context) error

Ready reports whether the manager's dependencies are currently usable: the mount repository, FUSE, and the configured irodsfs/mount/unmount helper binaries. It is meant for /readyz, which must reflect the daemon's actual current ability to do mount work, not merely that a MountManager object exists.

func (*MountManager) Reconcile

func (manager *MountManager) Reconcile(ctx context.Context) error

Reconcile loads every persisted mount record and reconciles it against the real system state observed through probe. When startup restoration is enabled it runs synchronously before the API begins accepting requests: a saved PID is never trusted as proof that this process still owns a mount, so identity is established solely through the mount table, never by signaling a recovered PID.

func (*MountManager) ReconcileTombstones

func (manager *MountManager) ReconcileTombstones(ctx context.Context) error

ReconcileTombstones resumes only persisted unmounts. It is used when startup restoration is disabled and by the periodic reconciler, so an ordinary record can never cause an unexpected remount outside startup.

func (*MountManager) Shutdown

func (manager *MountManager) Shutdown(ctx context.Context)

Shutdown safely stops every managed mount without deleting its record or marking it as a tombstone: an ordinary record means the mount must be running, so the next daemon start's reconciliation remounts it. Only an explicit Unmount ever tombstones a record. Mounts are stopped in parallel so one slow mount cannot block the others; each individual stop remains bounded by unmount_timeout or davfs_unmount_timeout. Shutdown returns once every mount has been stopped (or its own bounded stop attempt has given up), so the caller can close the repository and exit immediately afterward with no separate grace period.

func (*MountManager) SubscribeMountEvents

func (manager *MountManager) SubscribeMountEvents(request *api.WatchMountEventsRequest) (<-chan *api.MountEvent, func())

SubscribeMountEvents registers a buffered lifecycle-event subscriber. It queues initial snapshots while holding eventMutex, preventing a transition from being missed between subscription and the first received event.

func (*MountManager) Unmount

func (manager *MountManager) Unmount(ctx context.Context, request *api.UnmountRequest) (result *api.MountInfo, err error)

Unmount uses the client-appropriate unmount command and removes the mount record after any persistent child process has stopped.

type MountServer

type MountServer struct {
	api.UnimplementedMountServiceServer
	// contains filtered or unexported fields
}

MountServer exposes MountManager through the generated gRPC contract.

func NewMountServer

func NewMountServer(manager *MountManager) (*MountServer, error)

func (*MountServer) GetMount

func (server *MountServer) GetMount(ctx context.Context, request *api.GetMountRequest) (*api.GetMountResponse, error)

func (*MountServer) ListMounts

func (server *MountServer) ListMounts(ctx context.Context, request *api.ListMountsRequest) (*api.ListMountsResponse, error)

func (*MountServer) Mount

func (server *MountServer) Mount(ctx context.Context, request *api.MountRequest) (*api.MountResponse, error)

func (*MountServer) Ready

func (server *MountServer) Ready(ctx context.Context, request *api.ReadyRequest) (*api.ReadyResponse, error)

Ready reports whether the underlying manager's dependencies are currently usable.

func (*MountServer) Unmount

func (server *MountServer) Unmount(ctx context.Context, request *api.UnmountRequest) (*api.UnmountResponse, error)

func (*MountServer) WatchMountEvents

func (server *MountServer) WatchMountEvents(request *api.WatchMountEventsRequest, stream api.MountService_WatchMountEventsServer) error

WatchMountEvents streams mount lifecycle snapshots until the caller cancels its stream context.

type RESTHandler

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

func NewRESTHandler

func NewRESTHandler(server *MountServer, config *commons.Config) *RESTHandler

func (*RESTHandler) RegisterRoutes

func (handler *RESTHandler) RegisterRoutes(mux *http.ServeMux)

type Service

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

Service owns the gRPC and REST listeners and their shared mount API.

func NewService

func NewService(config *commons.Config) (*Service, error)

func (*Service) Release

func (svc *Service) Release()

func (*Service) Start

func (svc *Service) Start() error

func (*Service) Stop

func (svc *Service) Stop()

Stop drains the gRPC and REST listeners, cancels the periodic reconcile loop, then safely unmounts every managed mount before returning. Shutdown order follows design.md: HTTP drain, reconcile-loop cancellation, safe unmount and child signaling, controller wait — with no separate grace-period sleep, since each step above is itself already bounded.

Directories

Path Synopsis
Package logstore converts a mount child's stdout/stderr into a size- and age-rotated, line-oriented log file, and lets that file be queried by tail count or time.
Package logstore converts a mount child's stdout/stderr into a size- and age-rotated, line-oriented log file, and lets that file be queried by tail count or time.
Package store implements MountRepository on top of an embedded BadgerDB database, encrypted at rest, so mount intent and credentials survive a daemon restart.
Package store implements MountRepository on top of an embedded BadgerDB database, encrypted at rest, so mount intent and credentials survive a daemon restart.
Package web holds the daemon's embedded management UI: a single self-contained HTML page (inline CSS and vanilla JavaScript, no build step, no external network requests) served at "/", sharing the REST API origin per design.md.
Package web holds the daemon's embedded management UI: a single self-contained HTML page (inline CSS and vanilla JavaScript, no build step, no external network requests) served at "/", sharing the REST API origin per design.md.

Jump to

Keyboard shortcuts

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