commons

package
v0.6.25 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DataCacheSizeMaxDefault int64 = 1024 * 1024 * 1024 * 20 // 20GB

	ProfileServicePortDefault     int = 12021
	PrometheusExporterPortDefault int = 12022
)

Variables

This section is empty.

Functions

func ErrorToStatus added in v0.6.20

func ErrorToStatus(err error) error

ErrorToStatus converts error to grpc status error

func GetDefaultDataRootDirPath added in v0.6.0

func GetDefaultDataRootDirPath() string

func GetDefaultInstanceID added in v0.6.5

func GetDefaultInstanceID() string

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 IsDisconnectedError added in v0.6.25

func IsDisconnectedError(err error) bool

IsDisconnectedError returns true if connection is unavailable

func IsFileHandleNotFoundError added in v0.6.20

func IsFileHandleNotFoundError(err error) bool

IsFileHandleNotFoundError evaluates if the given error is file handle not found error

func IsIRODSFSClientInstanceNotFoundError added in v0.6.20

func IsIRODSFSClientInstanceNotFoundError(err error) bool

IsIRODSFSClientInstanceNotFoundError evaluates if the given error is irods fs client instance not found error

func IsReloginRequiredError added in v0.6.20

func IsReloginRequiredError(err error) bool

IsReloginRequiredError returns true if relogin can solve the issue

func IsSessionNotFoundError added in v0.6.20

func IsSessionNotFoundError(err error) bool

IsSessionNotFoundError evaluates if the given error is session not found error

func NewFileHandleNotFoundError added in v0.6.20

func NewFileHandleNotFoundError(handleID string) error

NewFileHandleNotFoundError creates an error for file handle not found error

func NewIRODSFSClientInstanceNotFoundError added in v0.6.20

func NewIRODSFSClientInstanceNotFoundError(instanceID string) error

NewIRODSFSClientInstanceNotFoundError creates IRODSFSClientInstanceNotFoundError struct

func NewSessionNotFoundError added in v0.6.20

func NewSessionNotFoundError(sessionID string) error

NewSessionNotFoundError creates SessionNotFoundError struct

func ParsePoolServiceEndpoint added in v0.5.6

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

ParsePoolServiceEndpoint parses endpoint string

func StatusToError added in v0.6.20

func StatusToError(err error) error

StatusToError converts grpc status error to error

Types

type Config

type Config struct {
	ServiceEndpoint      string                        `yaml:"service_endpoint"`
	DataCacheSizeMax     int64                         `yaml:"data_cache_size_max"`
	DataRootPath         string                        `yaml:"data_root_path,omitempty"`
	CacheTimeoutSettings []MetadataCacheTimeoutSetting `yaml:"cache_timeout_settings,omitempty"`

	LogPath string `yaml:"log_path,omitempty"`

	Profile                bool `yaml:"profile,omitempty"`
	ProfileServicePort     int  `yaml:"profile_service_port,omitempty"`
	PrometheusExporterPort int  `yaml:"prometheus_exporter_port,omitempty"`

	Foreground   bool `yaml:"foreground,omitempty"`
	Debug        bool `yaml:"debug,omitempty"`
	ChildProcess bool `yaml:"childprocess,omitempty"`

	InstanceID string `yaml:"instanceid,omitempty"`
}

Config holds the parameters list which can be configured

func NewConfigFromYAML

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

NewConfigFromYAML creates Config from YAML

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig returns a default config

func (*Config) CleanWorkDirs added in v0.6.0

func (config *Config) CleanWorkDirs() error

CleanWorkDirs cleans dirs used

func (*Config) GetDataCacheRootDirPath added in v0.6.0

func (config *Config) GetDataCacheRootDirPath() string

func (*Config) GetInstanceDataRootDirPath added in v0.6.1

func (config *Config) GetInstanceDataRootDirPath() string

func (*Config) GetLogFilePath added in v0.6.0

func (config *Config) GetLogFilePath() string

GetLogFilePath returns log file path

func (*Config) GetServiceEndpoint added in v0.6.3

func (config *Config) GetServiceEndpoint() string

func (*Config) MakeLogDir added in v0.6.0

func (config *Config) MakeLogDir() error

MakeLogDir makes a log dir required

func (*Config) MakeWorkDirs added in v0.6.0

func (config *Config) MakeWorkDirs() error

MakeWorkDirs makes dirs required

func (*Config) Validate

func (config *Config) Validate() error

Validate validates configuration

type FileHandleNotFoundError added in v0.6.20

type FileHandleNotFoundError struct {
	HandleID string
}

FileHandleNotFoundError contains file handle not found error information

func (*FileHandleNotFoundError) Error added in v0.6.20

func (err *FileHandleNotFoundError) Error() string

Error returns error message

func (*FileHandleNotFoundError) Is added in v0.6.20

func (err *FileHandleNotFoundError) Is(other error) bool

Is tests type of error

func (*FileHandleNotFoundError) ToString added in v0.6.20

func (err *FileHandleNotFoundError) ToString() string

ToString stringifies the object

type IRODSFSClientInstanceNotFoundError added in v0.6.20

type IRODSFSClientInstanceNotFoundError struct {
	InstanceID string
}

IRODSFSClientInstanceNotFoundError contains irods fs client instance not found error information

func (*IRODSFSClientInstanceNotFoundError) Error added in v0.6.20

Error returns error message

func (*IRODSFSClientInstanceNotFoundError) Is added in v0.6.20

Is tests type of error

func (*IRODSFSClientInstanceNotFoundError) ToString added in v0.6.20

ToString stringifies the object

type MetadataCacheTimeoutSetting added in v0.2.1

type MetadataCacheTimeoutSetting struct {
	Path    string                        `yaml:"path" json:"path"`
	Timeout irodsfs_common_utils.Duration `yaml:"timeout" json:"timeout"`
	Inherit bool                          `yaml:"inherit,omitempty" json:"inherit,omitempty"`
}

MetadataCacheTimeoutSetting defines cache timeout for path

type SessionNotFoundError added in v0.6.20

type SessionNotFoundError struct {
	SessionID string
}

SessionNotFoundError contains session not found error information

func (*SessionNotFoundError) Error added in v0.6.20

func (err *SessionNotFoundError) Error() string

Error returns error message

func (*SessionNotFoundError) Is added in v0.6.20

func (err *SessionNotFoundError) Is(other error) bool

Is tests type of error

func (*SessionNotFoundError) ToString added in v0.6.20

func (err *SessionNotFoundError) ToString() string

ToString stringifies the object

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