types

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2022 License: BSD-3-Clause Imports: 9 Imported by: 23

Documentation

Index

Constants

View Source
const (
	// PamTTLDefault is a default value for Pam TTL
	PamTTLDefault int = 1
)

Variables

This section is empty.

Functions

func GetFileOpenFlagSeekToEnd

func GetFileOpenFlagSeekToEnd(mode FileOpenMode) (int, bool)

GetFileOpenFlagSeekToEnd returns file open flag and returns true if file pointer moves to the file end

func GetIRODSErrorCode added in v0.5.1

func GetIRODSErrorCode(err error) common.ErrorCode

GetIRODSErrorCode returns iRODS error code if the error is iRODSError

func IsCollectionNotEmptyError added in v0.5.10

func IsCollectionNotEmptyError(err error) bool

IsCollectionNotEmptyError evaluates if the given error is CollectionNotEmptyError

func IsFileNotFoundError

func IsFileNotFoundError(err error) bool

IsFileNotFoundError evaluates if the given error is FileNotFoundError

func IsFileOpenFlagOpeningExisting

func IsFileOpenFlagOpeningExisting(mode FileOpenMode) bool

IsFileOpenFlagOpeningExisting returns true if the file open mode is for opening existing file

func IsFileOpenFlagRead

func IsFileOpenFlagRead(mode FileOpenMode) bool

IsFileOpenFlagRead returns true if the file open mode is for read

func IsFileOpenFlagWrite

func IsFileOpenFlagWrite(mode FileOpenMode) bool

IsFileOpenFlagWrite returns true if the file open mode is for write

func IsIRODSError added in v0.5.1

func IsIRODSError(err error) bool

IsIRODSError checks if the given error is IRODSError

Types

type AuthScheme

type AuthScheme string

AuthScheme defines Authentication Scheme

const (
	// AuthSchemeNative uses Native authentication scheme
	AuthSchemeNative AuthScheme = "native"
	// AuthSchemeGSI uses GSI authentication scheme
	AuthSchemeGSI AuthScheme = "gsi"
	// AuthSchemePAM uses PAM authentication scheme
	AuthSchemePAM AuthScheme = "pam"
)

func GetAuthScheme

func GetAuthScheme(authScheme string) (AuthScheme, error)

GetAuthScheme returns AuthScheme value from string

type CSNegotiationPolicy

type CSNegotiationPolicy string

CSNegotiationPolicy defines Negotiation result

const (
	// CSNegotiationFailure presents negotiation is failed
	CSNegotiationFailure CSNegotiationPolicy = "CS_NEG_FAILURE"
	// CSNegotiationUseTCP uses Plain TCP connection
	CSNegotiationUseTCP CSNegotiationPolicy = "CS_NEG_USE_TCP"
	// CSNegotiationUseSSL uses SSL connection
	CSNegotiationUseSSL CSNegotiationPolicy = "CS_NEG_USE_SSL"
)

func GetCSNegotiationPolicy

func GetCSNegotiationPolicy(policy string) (CSNegotiationPolicy, error)

GetCSNegotiationPolicy returns CSNegotiationPolicy value from string

func PerformCSNegotiation

func PerformCSNegotiation(clientRequest CSNegotiationRequire, serverRequest CSNegotiationRequire) CSNegotiationPolicy

PerformCSNegotiation performs CSNegotiation and returns the policy determined

type CSNegotiationRequire

type CSNegotiationRequire string

CSNegotiationRequire defines Negotiation request

const (
	// CSNegotiationRequireTCP requires Plain TCP connection
	CSNegotiationRequireTCP CSNegotiationRequire = "CS_NEG_REFUSE"
	// CSNegotiationRequireSSL requires SSL connection
	CSNegotiationRequireSSL CSNegotiationRequire = "CS_NEG_REQUIRE"
	// CSNegotiationDontCare requires any of TCP or SSL connection
	CSNegotiationDontCare CSNegotiationRequire = "CS_NEG_DONT_CARE"
)

func GetCSNegotiationRequire

func GetCSNegotiationRequire(require string) (CSNegotiationRequire, error)

GetCSNegotiationRequire returns CSNegotiationRequire value from string

type CollectionIOMetrics added in v0.5.11

type CollectionIOMetrics struct {
	Stat   uint64
	List   uint64
	Delete uint64
	Create uint64
	Rename uint64
	Meta   uint64
}

CollectionIOMetrics - represents collection IO for access

type CollectionNotEmptyError added in v0.5.10

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

CollectionNotEmptyError ...

func NewCollectionNotEmptyError added in v0.5.10

func NewCollectionNotEmptyError(message string) *CollectionNotEmptyError

NewCollectionNotEmptyError creates CollectionNotEmptyError struct

func NewCollectionNotEmptyErrorf added in v0.5.10

func NewCollectionNotEmptyErrorf(format string, v ...interface{}) *CollectionNotEmptyError

NewCollectionNotEmptyErrorf creates CollectionNotEmptyError struct

func (*CollectionNotEmptyError) Error added in v0.5.10

func (e *CollectionNotEmptyError) Error() string

type ColumnType

type ColumnType string

ColumnType is a type of iRODS Column

const (
	// ColumnTypeInteger is for integer column
	ColumnTypeInteger ColumnType = "Integer"
	// ColumnTypeString is for string column
	ColumnTypeString ColumnType = "String"
	// ColumnTypeDateTime is for datetime column
	ColumnTypeDateTime ColumnType = "DateTime"
)

type DataObjectIOMetrics added in v0.5.11

type DataObjectIOMetrics struct {
	Stat   uint64
	Read   uint64
	Write  uint64
	Delete uint64
	Create uint64
	Rename uint64
	Meta   uint64
}

DataObjectIOMetrics - represents data object IO for access

type FileNotFoundError

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

FileNotFoundError ...

func NewFileNotFoundError

func NewFileNotFoundError(message string) *FileNotFoundError

NewFileNotFoundError creates FileNotFoundError struct

func NewFileNotFoundErrorf

func NewFileNotFoundErrorf(format string, v ...interface{}) *FileNotFoundError

NewFileNotFoundErrorf creates FileNotFoundError struct

func (*FileNotFoundError) Error

func (e *FileNotFoundError) Error() string

type FileOpenFlag

type FileOpenFlag int

FileOpenFlag is internally used value, derived from FileOpenMode

const (
	// O_RDONLY is for read
	O_RDONLY FileOpenFlag = 0
	// O_WRONLY is for write
	O_WRONLY FileOpenFlag = 1
	// O_RDWR is for read and write
	O_RDWR FileOpenFlag = 2
	// O_APPEND is for append (moving the file pointer to the file end)
	O_APPEND FileOpenFlag = 1024
	// O_CREAT is for creating a file if not exists
	O_CREAT FileOpenFlag = 64
	// O_EXCL ...
	O_EXCL FileOpenFlag = 128
	// O_TRUNC is for truncating content
	O_TRUNC FileOpenFlag = 512
)

type FileOpenMode

type FileOpenMode string

FileOpenMode determines file open mode

const (
	// FileOpenModeReadOnly is for read
	FileOpenModeReadOnly FileOpenMode = "r"
	// FileOpenModeReadWrite is for read and write
	FileOpenModeReadWrite FileOpenMode = "r+"
	// FileOpenModeWriteOnly is for write
	FileOpenModeWriteOnly FileOpenMode = "w"
	// FileOpenModeWriteTruncate is for write, but truncates the file
	FileOpenModeWriteTruncate FileOpenMode = "w+"
	// FileOpenModeAppend is for write, not trucate, but appends from the file end
	FileOpenModeAppend FileOpenMode = "a"
	// FileOpenModeReadAppend is for read and write, but appends from the file end
	FileOpenModeReadAppend FileOpenMode = "a+"
)

type IRODSAccess

type IRODSAccess struct {
	Path        string
	UserName    string
	UserZone    string
	UserType    IRODSUserType
	AccessLevel IRODSAccessLevelType
}

IRODSAccess contains irods access information

func (*IRODSAccess) ToString

func (access *IRODSAccess) ToString() string

ToString stringifies the object

type IRODSAccessLevelType added in v0.3.0

type IRODSAccessLevelType string

IRODSAccessLevelType is a type for access level

const (
	// IRODSAccessLevelOwner is for owner access
	IRODSAccessLevelOwner IRODSAccessLevelType = "own"
	// IRODSAccessLevelWrite is for write access
	IRODSAccessLevelWrite IRODSAccessLevelType = "modify object"
	// IRODSAccessLevelRead is for read access
	IRODSAccessLevelRead IRODSAccessLevelType = "read object"
	// IRODSAccessLevelNone is for no access
	IRODSAccessLevelNone IRODSAccessLevelType = ""
)

func (IRODSAccessLevelType) ChmodString added in v0.4.5

func (accessType IRODSAccessLevelType) ChmodString() string

ChmodString returns the string for update access control messages.

type IRODSAccount

type IRODSAccount struct {
	AuthenticationScheme    AuthScheme
	ClientServerNegotiation bool
	CSNegotiationPolicy     CSNegotiationRequire
	Host                    string
	Port                    int
	ClientUser              string
	ClientZone              string
	ProxyUser               string
	ProxyZone               string
	ServerDN                string
	Password                string
	Ticket                  string
	PamTTL                  int
	SSLConfiguration        *IRODSSSLConfig
}

IRODSAccount contains irods login information

func CreateIRODSAccount

func CreateIRODSAccount(host string, port int, user string, zone string,
	authScheme AuthScheme, password string,
	serverDN string) (*IRODSAccount, error)

CreateIRODSAccount creates IRODSAccount

func CreateIRODSAccountForTicket added in v0.5.1

func CreateIRODSAccountForTicket(host string, port int, user string, zone string,
	authScheme AuthScheme, password string, ticket string,
	serverDN string) (*IRODSAccount, error)

CreateIRODSAccountForTicket creates IRODSAccount

func CreateIRODSAccountFromYAML

func CreateIRODSAccountFromYAML(yamlBytes []byte) (*IRODSAccount, error)

CreateIRODSAccountFromYAML creates IRODSAccount from YAML

func CreateIRODSProxyAccount

func CreateIRODSProxyAccount(host string, port int, clientUser string, clientZone string,
	proxyUser string, proxyZone string,
	authScheme AuthScheme, password string) (*IRODSAccount, error)

CreateIRODSProxyAccount creates IRODSAccount for proxy access

func (*IRODSAccount) MaskSensitiveData

func (account *IRODSAccount) MaskSensitiveData() *IRODSAccount

MaskSensitiveData returns IRODSAccount object with sensitive data masked

func (*IRODSAccount) SetCSNegotiation added in v0.7.3

func (account *IRODSAccount) SetCSNegotiation(requireNegotiation bool, requirePolicy CSNegotiationRequire)

SetCSNegotiation sets CSNegotiation policy

func (*IRODSAccount) SetSSLConfiguration

func (account *IRODSAccount) SetSSLConfiguration(sslConf *IRODSSSLConfig)

SetSSLConfiguration sets SSL Configuration

func (*IRODSAccount) UseProxyAccess

func (account *IRODSAccount) UseProxyAccess() bool

UseProxyAccess returns whether it uses proxy access or not

func (*IRODSAccount) UseTicket added in v0.5.1

func (account *IRODSAccount) UseTicket() bool

UseTicket returns whether it uses ticket for access control

type IRODSCollection

type IRODSCollection struct {
	ID int64
	// Path has an absolute path to the collection
	Path string
	// Name has only the name part of the path
	Name string
	// Owner has the owner's name
	Owner string
	// CreateTime has creation time
	CreateTime time.Time
	// ModifyTime has last modified time
	ModifyTime time.Time
}

IRODSCollection contains irods collection information

func (*IRODSCollection) ToString

func (coll *IRODSCollection) ToString() string

ToString stringifies the object

type IRODSColumn

type IRODSColumn struct {
	Type    ColumnType
	ICatKey string
	ICatID  int
}

IRODSColumn is a struct holding a column

type IRODSDataObject

type IRODSDataObject struct {
	ID           int64
	CollectionID int64
	// Path has an absolute path to the data object
	Path string
	// Name has only the name part of the path
	Name string
	// Size has the file size
	Size int64
	// Attributes has attributes
	//Attributes string
	// Replicas has replication information
	Replicas []*IRODSReplica
}

IRODSDataObject contains irods data object information

func (*IRODSDataObject) ToString

func (obj *IRODSDataObject) ToString() string

ToString stringifies the object

type IRODSError added in v0.5.1

type IRODSError struct {
	Code              common.ErrorCode
	Message           string
	ContextualMessage string
}

IRODSError contains irods error information

func NewIRODSError added in v0.5.1

func NewIRODSError(code common.ErrorCode) *IRODSError

NewIRODSError creates a new IRODSError

func NewIRODSErrorWithString added in v0.5.1

func NewIRODSErrorWithString(code common.ErrorCode, message string) *IRODSError

NewIRODSErrorWithString creates a new IRODSError with message

func (*IRODSError) Error added in v0.5.1

func (err *IRODSError) Error() string

Error returns error message

func (*IRODSError) GetCode added in v0.5.1

func (err *IRODSError) GetCode() common.ErrorCode

GetCode returns error code

func (*IRODSError) ToString added in v0.5.1

func (err *IRODSError) ToString() string

ToString stringifies the object

type IRODSFileHandle

type IRODSFileHandle struct {
	FileDescriptor int
	// Path has an absolute path to the data object
	Path     string
	OpenMode FileOpenMode
	Resource string
	Oper     common.OperationType
}

IRODSFileHandle contains file handle

func (*IRODSFileHandle) ToString

func (handle *IRODSFileHandle) ToString() string

ToString stringifies the object

type IRODSMeta

type IRODSMeta struct {
	AVUID int64 // is ignored on metadata operations (set, add, mod, rm)
	Name  string
	Value string
	Units string
}

IRODSMeta contains irods metadata

func (*IRODSMeta) ToString

func (meta *IRODSMeta) ToString() string

ToString stringifies the object

type IRODSMetaCollection

type IRODSMetaCollection struct {
	Path string
}

IRODSMetaCollection contains irods data object information

func (*IRODSMetaCollection) ToString

func (meta *IRODSMetaCollection) ToString() string

ToString stringifies the object

type IRODSMetaItemType added in v0.2.0

type IRODSMetaItemType string

IRODSMetaItemType describes a type to set metadata on

const (
	// IRODSDataObjectMetaItemType is a type for data object meta
	IRODSDataObjectMetaItemType IRODSMetaItemType = "-d"
	// IRODSCollectionMetaItemType is a type for collection meta
	IRODSCollectionMetaItemType IRODSMetaItemType = "-C"
	// IRODSResourceMetaItemType is a type for resource meta
	IRODSResourceMetaItemType IRODSMetaItemType = "-R"
	// IRODSUserMetaItemType is a type for user meta
	IRODSUserMetaItemType IRODSMetaItemType = "-u"
)

func GetIRODSMetaItemType added in v0.2.0

func GetIRODSMetaItemType(data interface{}) (IRODSMetaItemType, error)

GetIRODSMetaItemType gets the irods metadata item type from an object.

type IRODSQuota added in v0.4.5

type IRODSQuota struct {
	RescName string
	Limit    int64
}

IRODSQuota describes a resource quota

func (*IRODSQuota) ToString added in v0.4.5

func (q *IRODSQuota) ToString() string

ToString stringifies the object

type IRODSReplica

type IRODSReplica struct {
	Number int64

	// Owner has the owner's name
	Owner string

	// CheckSum has the checksum of the file
	CheckSum     string
	Status       string
	ResourceName string

	// Path has an absolute path to the data object
	Path              string
	ResourceHierarchy string

	// CreateTime has creation time
	CreateTime time.Time
	// ModifyTime has last modified time
	ModifyTime time.Time
}

IRODSReplica contains irods data object replication information

func (*IRODSReplica) ToString

func (obj *IRODSReplica) ToString() string

ToString stringifies the object

type IRODSResource added in v0.4.0

type IRODSResource struct {
	RescID   int64
	Name     string
	Zone     string
	Type     string
	Class    string
	Location string

	// Path has the path string of the resource
	Path string

	// Context has the context string
	Context string

	// CreateTime has creation time
	CreateTime time.Time
	// ModifyTime has last modified time
	ModifyTime time.Time
}

IRODSResource describes a resource host

func (*IRODSResource) ToString added in v0.4.0

func (res *IRODSResource) ToString() string

ToString stringifies the object

type IRODSSSLConfig

type IRODSSSLConfig struct {
	CACertificateFile   string
	EncryptionKeySize   int
	EncryptionAlgorithm string
	SaltSize            int
	HashRounds          int
}

IRODSSSLConfig contains irods ssl configuration

func CreateIRODSSSLConfig

func CreateIRODSSSLConfig(caCertFile string, keySize int, algorithm string, saltSize int,
	hashRounds int) (*IRODSSSLConfig, error)

CreateIRODSSSLConfig creates IRODSSSLConfig

func (*IRODSSSLConfig) ReadCACert

func (config *IRODSSSLConfig) ReadCACert() ([]byte, error)

ReadCACert returns CA Cert data

type IRODSTicket added in v0.7.0

type IRODSTicket struct {
	ID int64
	// Name is ticket string
	Name string
	// Type is access type
	Type TicketType
	// Owner has the owner's name
	Owner string
	// ObjectType is type of object
	ObjectType ObjectType
	// Path is path to the object
	Path string
	// ExpireTime is time that the ticket expires
	ExpireTime time.Time
	// UsesLimit is an access limit
	UsesLimit int64
	// UsesCount is an access count
	UsesCount int64
	// WriteFileLimit is a write file limit
	WriteFileLimit int64
	// WriteFileCount is a write file count
	WriteFileCount int64
	// WriteByteLimit is a write byte limit
	WriteByteLimit int64
	// WriteByteCount is a write byte count
	WriteByteCount int64
}

IRODSTicket contains irods ticket information

func (*IRODSTicket) ToString added in v0.7.0

func (ticket *IRODSTicket) ToString() string

ToString stringifies the object

type IRODSTicketForAnonymousAccess added in v0.7.0

type IRODSTicketForAnonymousAccess struct {
	ID int64
	// Name is ticket string
	Name string
	// Type is access type
	Type TicketType
	// Path is path to the object
	Path string
	// ExpireTime is time that the ticket expires
	ExpireTime time.Time
}

IRODSTicketForAnonymousAccess contains minimal irods ticket information for anonymous access

func (*IRODSTicketForAnonymousAccess) ToString added in v0.7.0

func (ticket *IRODSTicketForAnonymousAccess) ToString() string

ToString stringifies the object

type IRODSUser

type IRODSUser struct {
	ID   int64
	Name string
	Zone string
	Type IRODSUserType
}

IRODSUser contains irods user information

func (*IRODSUser) ToString

func (user *IRODSUser) ToString() string

ToString stringifies the object

type IRODSUserType added in v0.3.0

type IRODSUserType string

IRODSUserType is a type of iRODS User

const (
	// IRODSUserRodsGroup is for a group
	IRODSUserRodsGroup IRODSUserType = "rodsgroup"
	// IRODSUserRodsUser is for a user
	IRODSUserRodsUser IRODSUserType = "rodsuser"
	// IRODSUserRodsAdmin is for an admin user
	IRODSUserRodsAdmin IRODSUserType = "rodsadmin"
	// IRODSUserGroupAdmin is for an admin group
	IRODSUserGroupAdmin IRODSUserType = "groupadmin"
)

type IRODSVersion

type IRODSVersion struct {
	ReleaseVersion string // e.g., "rods4.2.8"
	APIVersion     string
	ReconnectPort  int
	ReconnectAddr  string
	Cookie         int
}

IRODSVersion contains irods version information

func (*IRODSVersion) GetReleaseVersion added in v0.5.2

func (ver *IRODSVersion) GetReleaseVersion() (int, int, int)

GetReleaseVersion returns version parts (major, minor, patch)

func (*IRODSVersion) HasHigherVersionThan added in v0.5.2

func (ver *IRODSVersion) HasHigherVersionThan(major int, minor int, patch int) bool

HasHigherVersionThan returns if given version is higher or equal than current version

type IRODSZone

type IRODSZone struct {
	ID   string
	Name string
	Type string
}

IRODSZone contains irods zone information

func (*IRODSZone) ToString

func (zone *IRODSZone) ToString() string

ToString stringifies the object

type ObjectType added in v0.7.0

type ObjectType string
const (
	// ObjectTypeDataObject is for DataObject
	ObjectTypeDataObject ObjectType = "data-object"
	// ObjectTypeCollection is for Collection
	ObjectTypeCollection ObjectType = "collection"
)

type TicketType added in v0.7.0

type TicketType string

TicketType determines ticket access type

const (
	// TicketTypeRead is for read
	TicketTypeRead TicketType = "read"
	// TicketTypeWrite is for write
	TicketTypeWrite TicketType = "write"
)

type TransferMetrics added in v0.5.11

type TransferMetrics struct {
	BytesReceived uint64
	BytesSent     uint64
	CollectionIO  CollectionIOMetrics
	DataObjectIO  DataObjectIOMetrics
}

TransferMetrics - represents bytes transferred for access

type Whence

type Whence int

Whence determines where to start counting the offset

const (
	// SeekSet means offset starts from file start
	SeekSet Whence = 0
	// SeekCur means offset starts from current offset
	SeekCur Whence = 1
	// SeekEnd means offset starts from file end
	SeekEnd Whence = 2
)

Jump to

Keyboard shortcuts

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