commons

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: BSD-3-Clause Imports: 26 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DataRootPathFallback string = "/var/lib/irodsfs"

	ReadAheadMaxDefault int = 1024 * 128      // 128KB
	ReadWriteMaxDefault int = 1 * 1024 * 1024 // 1MB

	// not in-use
	FilesystemTimeout          time.Duration = 10 * time.Minute
	TCPBufferSizeDefault       int           = 4 * 1024 * 1024 // 4MB
	TCPBufferSizeStringDefault string        = "4MB"
	ConnectionMaxDefault       int           = 10

	ClientProgramName string = "irodsfs"
	FuseFSName        string = "irodsfs"
)

Variables

View Source
var ErrFuseInstallationError = errors.New("fuse is not installed")

Functions

func CheckFuse

func CheckFuse(checkFusermount bool) error

CheckFuse checks whether FUSE and, when requested, fusermount are available.

func CorrectSystemUser added in v0.13.0

func CorrectSystemUser(username string, uid int, gid int) (string, int, int, error)

CorrectSystemUser returns username, uid, gid of the resolved system user. If nothing is specified, falls back to the current process user.

func GetClientVersion

func GetClientVersion() string

GetClientVersion returns client version in string

func GetDefaultDataRootDirPath added in v0.8.0

func GetDefaultDataRootDirPath() string

GetDefaultDataRootDirPath returns default data root path

func GetDefaultIRODSConfigPath added in v0.10.1

func GetDefaultIRODSConfigPath() string

GetDefaultIRODSConfigPath returns default config path

func GetDefaultInstanceID added in v0.8.4

func GetDefaultInstanceID() string

GetDefaultInstanceID returns default instance id

func GetVersionJSON

func GetVersionJSON() (string, error)

GetVersionJSON returns VersionInfo object in JSON string

func GetVersionParts added in v0.10.1

func GetVersionParts(version string) (int, int, int)

GetVersionParts returns version parts (major, minor, patch)

func Input added in v0.10.3

func Input(msg string) string

func InputPassword added in v0.10.3

func InputPassword(msg string) string

func IsNewerVersion added in v0.10.1

func IsNewerVersion(ver1 []int, ver2 []int) bool

IsNewerVersion compares ver1 against ver2

func ParsePoolServiceEndpoint added in v0.7.3

func ParsePoolServiceEndpoint(endpoint string) (string, string, error)

ParsePoolServiceEndpoint parses endpoint string

func UnmountFuse

func UnmountFuse(mountPoint string) error

UnmountFuse lazily unmounts mountPoint using fusermount3 or fusermount.

Types

type Config

type Config struct {
	irodsclient_config.Config // irods config

	MountPath    string `json:"mount_path,omitempty" yaml:"mount_path,omitempty"`
	DataRootPath string `json:"data_root_path,omitempty" yaml:"data_root_path,omitempty"`

	PathMappings []vpath.VPathMapping `json:"path_mappings,omitempty" yaml:"path_mappings,omitempty"`
	ReadAheadMax int                  `json:"read_ahead_max,omitempty" yaml:"read_ahead_max,omitempty"`
	ReadWriteMax int                  `json:"read_write_max,omitempty" yaml:"read_write_max,omitempty"`
	Readonly     bool                 `json:"readonly,omitempty" yaml:"readonly,omitempty"`
	FuseOptions  []string             `json:"fuse_options,omitempty" yaml:"fuse_options,omitempty"`

	UID        int    `json:"uid,omitempty" yaml:"uid,omitempty"`
	GID        int    `json:"gid,omitempty" yaml:"gid,omitempty"`
	SystemUser string `json:"system_user,omitempty" yaml:"system_user,omitempty"`

	MetadataConnection irodsclient_fs.ConnectionConfig `json:"metadata_connection,omitempty" yaml:"metadata_connection,omitempty"`
	IOConnection       irodsclient_fs.ConnectionConfig `json:"io_connection,omitempty" yaml:"io_connection,omitempty"`
	Cache              irodsclient_fs.CacheConfig      `json:"cache,omitempty" yaml:"cache,omitempty"`

	PoolEndpoint string `json:"pool_endpoint,omitempty" yaml:"pool_endpoint,omitempty"`

	Foreground bool `json:"foreground,omitempty" yaml:"foreground,omitempty"`
	Debug      bool `json:"debug,omitempty" yaml:"debug,omitempty"`

	InstanceID  string `json:"instanceid,omitempty" yaml:"instanceid,omitempty"`
	LogPath     string `json:"log_path,omitempty" yaml:"log_path,omitempty"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
}

Config holds the parameters list which can be configured

func NewConfigFromFile added in v0.10.1

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

NewConfigFromFile creates Config from file

func NewConfigFromICommandsEnvDir added in v0.10.1

func NewConfigFromICommandsEnvDir(config *Config, dirPath string) (*Config, error)

NewConfigFromICommandsEnvDir creates Config from icommands environment dir (e.g., ~/.irods)

func NewConfigFromJSON added in v0.13.0

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

NewConfigFromJSON creates Config from JSON

func NewConfigFromJSONFile added in v0.10.1

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

NewConfigFromJSONFile creates Config from JSON

func NewConfigFromStdin added in v0.13.0

func NewConfigFromStdin(config *Config, bytes []byte) (*Config, error)

func NewConfigFromYAML

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

NewConfigFromYAML creates Config from YAML

func NewConfigFromYAMLFile added in v0.10.1

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

NewConfigFromYAMLFile creates Config from YAML

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig returns a default config

func (*Config) FixPathMappings added in v0.10.1

func (config *Config) FixPathMappings()

FixPathMappings fixes path mappings

func (*Config) FixSystemUserConfiguration added in v0.10.5

func (config *Config) FixSystemUserConfiguration() error

FixSystemUserConfiguration fixes system user configuration

func (*Config) FromIRODSUrl added in v0.10.1

func (config *Config) FromIRODSUrl(inputURL string) error

FromIRODSUrl reads info from inputURL and updates config

func (*Config) GetDataRootPath added in v0.13.0

func (config *Config) GetDataRootPath() string

func (*Config) GetLogFilePath added in v0.8.0

func (config *Config) GetLogFilePath() string

GetLogFilePath returns log file path

func (*Config) GetLogWriter added in v0.13.0

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

func (*Config) MakeLogDir added in v0.8.0

func (config *Config) MakeLogDir() error

MakeLogDir makes a log dir required

func (*Config) MakeWorkDirs added in v0.8.0

func (config *Config) MakeWorkDirs() error

MakeWorkDirs makes dirs required

func (*Config) Validate

func (config *Config) Validate() error

Validate validates configuration

type DataFormat added in v0.13.0

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

func DetectFormat added in v0.13.0

func DetectFormat(data []byte) DataFormat

DetectFormat checks format

type IRODSAccessURL added in v0.10.1

type IRODSAccessURL struct {
	User     string
	Password string
	Host     string
	Port     int
	Zone     string
	Path     string
}

IRODSAccessURL holds iRODS connection details parsed from an irods:// URL

func ParseIRODSUrl added in v0.10.1

func ParseIRODSUrl(inputURL string) (*IRODSAccessURL, error)

ParseIRODSUrl parses an irods:// URL and returns an IRODSAccessURL

type MultiWriteCloser added in v0.13.0

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

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

func NewMultiWriteCloser added in v0.13.0

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

func (*MultiWriteCloser) Close added in v0.13.0

func (mw *MultiWriteCloser) Close() error

func (*MultiWriteCloser) Write added in v0.13.0

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

type VersionInfo

type VersionInfo struct {
	ClientVersion string `json:"clientVersion"`
	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