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

commons

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: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IRODSFSExecutablePathDefault string = "/usr/local/bin/irodsfs"
	MountExecutablePathDefault   string = "/usr/bin/mount"
	UnmountExecutablePathDefault string = "/usr/bin/umount"
	DataRootPathDefault          string = "/var/lib/irodsfsd"
	PIDFilePathDefault           string = "/run/irodsfsd/irodsfsd.pid"
	AllowedMountRootPathDefault  string = "/mnt/irods"
	KubeletMountRootPathDefault  string = "/var/lib/kubelet"

	MountRootPathDefault     string = "mounts"
	MountDatabasePathDefault string = "db"

	RetryMaxAttemptsDefault  int           = 5
	RetryInitialDelayDefault time.Duration = time.Second
	RetryMaxDelayDefault     time.Duration = 30 * time.Second
	RetryMultiplierDefault   float64       = 2
	RetryJitterDefault       float64       = 0.2

	MountTimeoutDefault        time.Duration = 30 * time.Second
	UnmountTimeoutDefault      time.Duration = 15 * time.Second
	DAVFSUnmountTimeoutDefault time.Duration = 3 * time.Minute
	ReconcileIntervalDefault   time.Duration = 10 * time.Second
	MaxConcurrentMountsDefault int           = 40

	RecoveryEncryptionKeySizeDefault int = 32

	ManagementServiceEndpointDefault string = "http://0.0.0.0:13021"
)

Variables

View Source
var IRODSFSExecutablePathFallbacks = []string{"/usr/bin/irodsfs"}

IRODSFSExecutablePathFallbacks lists additional locations searched for the irodsfs binary when IRODSFSExecutablePath is left at IRODSFSExecutablePathDefault and that path doesn't exist. Different ways of installing irodsfs (this project's own installer vs. a distro package) place the binary in different standard locations; an explicitly configured non-default path is never second-guessed this way.

Functions

func GetServiceVersion

func GetServiceVersion() string

GetServiceVersion returns service version in string

func GetVersionJSON

func GetVersionJSON() (string, error)

GetVersionJSON returns VersionInfo object in JSON string

func ParseManagementServiceEndpoint added in v0.1.3

func ParseManagementServiceEndpoint(endpoint string) (string, error)

ParseManagementServiceEndpoint validates an HTTP management endpoint and returns the address suitable for net/http's Server.Addr. An empty endpoint disables the management service.

func ParseServiceEndpoint

func ParseServiceEndpoint(endpoint string) (string, string, error)

ParseServiceEndpoint parses endpoint string

Types

type Config

type Config struct {
	ServiceEndpoint       string `yaml:"service_endpoint,omitempty" json:"service_endpoint,omitempty"`
	IRODSFSExecutablePath string `yaml:"irodsfs_executable_path,omitempty" json:"irodsfs_executable_path,omitempty"`
	MountExecutablePath   string `yaml:"mount_executable_path,omitempty" json:"mount_executable_path,omitempty"`
	UnmountExecutablePath string `yaml:"unmount_executable_path,omitempty" json:"unmount_executable_path,omitempty"`
	DataRootPath          string `yaml:"data_root_path,omitempty" json:"data_root_path,omitempty"`
	PIDFile               string `yaml:"pid_file,omitempty" json:"pid_file,omitempty"`

	RecoveryEncryptionKey string `yaml:"recovery_encryption_key,omitempty" json:"recovery_encryption_key,omitempty"`

	AllowedMountRootPaths []string `yaml:"allowed_mount_root_paths,omitempty" json:"allowed_mount_root_paths,omitempty"`
	// AllowFuseAllowOther is design.md's "daemon-wide policy" gate: a mount
	// request may only ask for the FUSE allow_other option (irodsfs or
	// DAVFS) when this is true. allow_other lets every local user on the
	// host reach the mount, not just the irodsfsd service account that
	// actually performed it, so it must be an explicit, host-level opt-in
	// rather than something any mount request can request on its own.
	AllowFuseAllowOther bool `yaml:"allow_fuse_allow_other,omitempty" json:"allow_fuse_allow_other,omitempty"`
	// AutoRemount controls whether a mount which has already become mounted is
	// retried after a later mount-process failure. Initial mount failures still
	// use Retry regardless of this setting.
	AutoRemount bool `yaml:"auto_remount,omitempty" json:"auto_remount,omitempty"`
	// RestoreMountsOnRestart controls whether ordinary persisted mounts are
	// restored while the daemon is starting. Unmount tombstones are always
	// reconciled so an accepted unmount can finish safely.
	RestoreMountsOnRestart bool        `yaml:"restore_mounts_on_restart,omitempty" json:"restore_mounts_on_restart,omitempty"`
	Retry                  RetryConfig `yaml:"retry,omitempty" json:"retry,omitempty"`
	MountTimeout           Duration    `yaml:"mount_timeout,omitempty" json:"mount_timeout,omitempty"`
	UnmountTimeout         Duration    `yaml:"unmount_timeout,omitempty" json:"unmount_timeout,omitempty"`
	DAVFSUnmountTimeout    Duration    `yaml:"davfs_unmount_timeout,omitempty" json:"davfs_unmount_timeout,omitempty"`
	ReconcileInterval      Duration    `yaml:"reconcile_interval,omitempty" json:"reconcile_interval,omitempty"`
	MaxConcurrentMounts    int         `yaml:"max_concurrent_mounts,omitempty" json:"max_concurrent_mounts,omitempty"`

	// ManagementServiceEndpoint is the HTTP address on which the management
	// REST API listens. A missing scheme is treated as HTTP; an empty value
	// disables the management REST API.
	ManagementServiceEndpoint string `yaml:"management_service_endpoint,omitempty" json:"management_service_endpoint,omitempty"`

	Debug         bool   `yaml:"debug,omitempty" json:"debug,omitempty"`
	LogRootPath   string `yaml:"log_root_path,omitempty" json:"log_root_path,omitempty"`
	MountRootPath string `yaml:"mount_root_path,omitempty" json:"mount_root_path,omitempty"`
}

Config holds the parameters list which can be configured

func NewConfigFromFile

func NewConfigFromFile(config *Config, filePath string) (*Config, error)

NewConfigFromFile creates Config from file

func NewConfigFromJSON

func NewConfigFromJSON(config *Config, jsonBytes []byte) (*Config, error)

NewConfigFromJSON creates Config from JSON

func NewConfigFromJSONFile

func NewConfigFromJSONFile(config *Config, jsonPath string) (*Config, error)

NewConfigFromJSONFile creates Config from JSON

func NewConfigFromYAML

func NewConfigFromYAML(config *Config, yamlBytes []byte) (*Config, error)

NewConfigFromYAML creates Config from YAML

func NewConfigFromYAMLFile

func NewConfigFromYAMLFile(config *Config, yamlPath string) (*Config, error)

NewConfigFromYAMLFile creates Config from YAML

func NewDefaultConfig

func NewDefaultConfig() *Config

func (*Config) GetDataRootPath

func (config *Config) GetDataRootPath() string

func (*Config) GetLogFilePath

func (config *Config) GetLogFilePath() string

GetLogFilePath returns the daemon stdout/stderr log file path.

func (*Config) GetLogRootPath

func (config *Config) GetLogRootPath() string

GetLogRootPath returns the directory containing service and session logs.

func (*Config) GetLogWriter

func (config *Config) GetLogWriter(foregroundProcess bool) (io.WriteCloser, error)

func (*Config) GetMountDatabasePath

func (config *Config) GetMountDatabasePath() string

GetMountDatabasePath returns the directory holding the embedded mount database that persists mount intent across daemon restarts.

func (*Config) GetMountLogPath

func (config *Config) GetMountLogPath(mountID string) string

GetMountLogPath returns the log file path for one mount's child stdout/stderr, stable across daemon restarts and mount retries so its history remains queryable.

func (*Config) GetMountRootPath

func (config *Config) GetMountRootPath() string

GetMountRootPath returns the parent directory for managed irodsfs data roots.

func (*Config) GetRecoveryEncryptionKey

func (config *Config) GetRecoveryEncryptionKey() ([]byte, error)

GetRecoveryEncryptionKey decodes the configured 256-bit Badger encryption key.

func (*Config) GetServiceEndpoint

func (config *Config) GetServiceEndpoint() string

func (*Config) MakeLogDir

func (config *Config) MakeLogDir() error

MakeLogDir makes a log dir required

func (*Config) MakeWorkDirs

func (config *Config) MakeWorkDirs() error

MakeWorkDirs makes dirs required

func (*Config) Validate

func (config *Config) Validate() error

Validate validates configuration

type DataFormat

type DataFormat string
const (
	FormatJSON    DataFormat = "JSON"
	FormatYAML    DataFormat = "YAML"
	FormatUnknown DataFormat = "Unknown"
)

func DetectFormat

func DetectFormat(data []byte) DataFormat

DetectFormat checks format

type Duration

type Duration time.Duration

Duration is a replacement of time.Duration that supports JSON

func (*Duration) MarshalJSON

func (d *Duration) MarshalJSON() ([]byte, error)

MarshalJSON ...

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

UnmarshalJSON ...

func (*Duration) UnmarshalYAML

func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML ...

type MultiWriteCloser

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

MultiWriteCloser writes to multiple writers and closes the ones that implement io.Closer.

func NewMultiWriteCloser

func NewMultiWriteCloser(writers ...io.Writer) *MultiWriteCloser

func (*MultiWriteCloser) Close

func (mw *MultiWriteCloser) Close() error

func (*MultiWriteCloser) Write

func (mw *MultiWriteCloser) Write(p []byte) (n int, err error)

type RetryConfig

type RetryConfig struct {
	MaxAttempts  int      `yaml:"max_attempts,omitempty" json:"max_attempts,omitempty"`
	InitialDelay Duration `yaml:"initial_delay,omitempty" json:"initial_delay,omitempty"`
	MaxDelay     Duration `yaml:"max_delay,omitempty" json:"max_delay,omitempty"`
	Multiplier   float64  `yaml:"multiplier,omitempty" json:"multiplier,omitempty"`
	Jitter       float64  `yaml:"jitter,omitempty" json:"jitter,omitempty"`
}

type StacktraceTextFormatter

type StacktraceTextFormatter struct {
	TextFormatter log.TextFormatter
}

func (*StacktraceTextFormatter) Format

func (f *StacktraceTextFormatter) Format(entry *log.Entry) ([]byte, error)

type VersionInfo

type VersionInfo struct {
	ServiceVersion string `json:"serviceVersion"`
	GitCommit      string `json:"gitCommit"`
	BuildDate      string `json:"buildDate"`
	GoVersion      string `json:"goVersion"`
	Compiler       string `json:"compiler"`
	Platform       string `json:"platform"`
}

VersionInfo object contains version related info

func GetVersion

func GetVersion() VersionInfo

GetVersion returns VersionInfo object

Jump to

Keyboard shortcuts

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