util

package
v0.14.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// TransferTaskMinLength is a minimum data length of a task for parallel data transfer
	TransferTaskMinLength int64 = 32 * 1024 * 1024 // 32MB
	// TransferTaskMaxNum is a maximum number of tasks for parallel data transfer
	TransferTaskMaxNum int = 4
	// TransferBlockSize is a block size of a task
	TransferBlockSize int64 = 1024 * 1024 // 1MB
)

Variables

This section is empty.

Functions

func Decrypt added in v0.14.0

func Decrypt(algorithm types.EncryptionAlgorithm, key []byte, salt []byte, source []byte, dest []byte) (int, error)

Decrypt decrypts data

func Encrypt added in v0.14.0

func Encrypt(algorithm types.EncryptionAlgorithm, key []byte, salt []byte, source []byte, dest []byte) (int, error)

Encrypt encrypts data

func EscapeXMLSpecialChars added in v0.9.7

func EscapeXMLSpecialChars(in string) string

EscapeXMLSpecialChars escape special chars for XML

func ExistFile added in v0.10.0

func ExistFile(path string) bool

func ExpandHomeDir added in v0.10.0

func ExpandHomeDir(path string) (string, error)

func GetBasename added in v0.12.20

func GetBasename(p string) string

func GetBlockSizeForParallelTransfer added in v0.5.2

func GetBlockSizeForParallelTransfer(dataObjectLength int64) int64

GetBlockSizeForParallelTransfer returns the block size

func GetCorrectIRODSPath

func GetCorrectIRODSPath(p string) string

GetCorrectIRODSPath corrects the path

func GetCorrectLocalPath added in v0.10.7

func GetCorrectLocalPath(p string) string

GetCorrectLocalPath corrects the path

func GetDir added in v0.12.20

func GetDir(p string) string

func GetEncoderRing added in v0.10.0

func GetEncoderRing(key string) []byte

GetEncoderRing returns encoder ring

func GetHashLocalFile added in v0.14.0

func GetHashLocalFile(sourcePath string, hashAlg hash.Hash) ([]byte, error)

func GetHashStrings added in v0.14.0

func GetHashStrings(strs []string, hashAlg hash.Hash) ([]byte, error)

func GetIRODSDateTime

func GetIRODSDateTime(timestring string) (time.Time, error)

GetIRODSDateTime returns time struct from string IRODS time

func GetIRODSDateTimeStringForTicket added in v0.12.0

func GetIRODSDateTimeStringForTicket(t time.Time) string

GetIRODSDateTimeStringForTicket returns IRODS time string from time struct

func GetIRODSPathDepth added in v0.9.4

func GetIRODSPathDepth(p string) int

GetIRODSPathDepth returns depth of the path "/" returns 0 "abc" returns -1 "/abc" returns 0 "/a/b" returns 1 "/a/b/c" returns 2

func GetIRODSPathDirname

func GetIRODSPathDirname(p string) string

GetIRODSPathDirname returns the dir of the path

func GetIRODSPathFileName

func GetIRODSPathFileName(p string) string

GetIRODSPathFileName returns the filename of the path

func GetIRODSZone

func GetIRODSZone(p string) (string, error)

GetIRODSZone returns the zone of the path

func GetNumTasksForParallelTransfer added in v0.5.2

func GetNumTasksForParallelTransfer(dataObjectLength int64) int

GetNumTasksForParallelTransfer returns the number transfer tasks to be used

func GetParentIRODSDirs added in v0.9.4

func GetParentIRODSDirs(p string) []string

GetParentDirs returns all parent dirs

func GetPasswordPadded added in v0.10.0

func GetPasswordPadded(newPassword string) string

GetPasswordPadded returns password with padding

func GetRelativeIRODSPath added in v0.9.4

func GetRelativeIRODSPath(base string, target string) (string, error)

GetRelativePath returns relative path

func HashLocalFile added in v0.14.0

func HashLocalFile(sourcePath string, hashAlg string) ([]byte, error)

func HashStrings added in v0.14.0

func HashStrings(strs []string, hashAlg string) ([]byte, error)

func Join added in v0.12.20

func Join(p1 string, p2 ...string) string

func MakeIRODSPath

func MakeIRODSPath(collectionPath string, dataobjectName string) string

MakeIRODSPath makes the path from collection and data object

func MakeRandomString added in v0.10.0

func MakeRandomString(size int) string

MakeRandomString returns a random string

func ObfuscateNewPassword added in v0.10.0

func ObfuscateNewPassword(newPassword string, oldPassword string, signature string) string

ObfuscateNewPassword obfuscates new password for changing

func ReadBytes

func ReadBytes(socket net.Conn, buffer []byte, size int) (int, error)

ReadBytes reads data from socket in a particular size

func ReadBytesWithTrackerCallBack added in v0.10.8

func ReadBytesWithTrackerCallBack(socket net.Conn, buffer []byte, size int, callback common.TrackerCallBack) (int, error)

ReadBytesWithTrackerCallBack reads data from socket in a particular size

func Scramble added in v0.4.4

func Scramble(toScramble string, key string, scramblePrefix string, blockChaining bool) string

Scramble scrambles string

func ScrambleV2 added in v0.10.0

func ScrambleV2(newPassword string, oldPassword string, signature string) string

ScrambleV2 scrambles string (ver2)

func SplitIRODSPath

func SplitIRODSPath(p string) (string, string)

SplitIRODSPath splits the path into dir and file

func WaitTimeout added in v0.9.3

func WaitTimeout(wg *sync.WaitGroup, timeout time.Duration) bool

WaitTimeout waits for the waitgroup for the specified max timeout. Returns true if waiting timed out.

func WriteBytes

func WriteBytes(socket net.Conn, buffer []byte, size int) error

WriteBytes writes data to socket

func WriteBytesWithTrackerCallBack added in v0.10.8

func WriteBytesWithTrackerCallBack(socket net.Conn, buffer []byte, size int, callback common.TrackerCallBack) error

WriteBytesWithTrackerCallBack writes data to socket

Types

This section is empty.

Jump to

Keyboard shortcuts

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