util

package
v0.0.0-...-66d3456 Latest Latest
Warning

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

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

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

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

Decrypt decrypts data

func Encrypt

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

Encrypt encrypts data

func EscapeXMLSpecialChars

func EscapeXMLSpecialChars(in string) string

EscapeXMLSpecialChars escape special chars for XML

func ExistFile

func ExistFile(path string) bool

func ExpandHomeDir

func ExpandHomeDir(path string) (string, error)

func GetBasename

func GetBasename(p string) string

func GetBlockSizeForParallelTransfer

func GetBlockSizeForParallelTransfer(dataObjectLength int64) int64

GetBlockSizeForParallelTransfer returns the block size

func GetCorrectIRODSPath

func GetCorrectIRODSPath(p string) string

GetCorrectIRODSPath corrects the path

func GetCorrectLocalPath

func GetCorrectLocalPath(p string) string

GetCorrectLocalPath corrects the path

func GetDir

func GetDir(p string) string

func GetEncoderRing

func GetEncoderRing(key string) []byte

GetEncoderRing returns encoder ring

func GetEncryptionBlockSize

func GetEncryptionBlockSize(algorithm types.EncryptionAlgorithm) int

GetEncryptionBlockSize returns block size

func GetEncryptionIV

func GetEncryptionIV(algorithm types.EncryptionAlgorithm) ([]byte, error)

GetEncryptionIV returns a new IV

func GetHashLocalFile

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

func GetHashStrings

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

func GetIRODSDateTimeStringForTicket(t time.Time) string

GetIRODSDateTimeStringForTicket returns IRODS time string from time struct

func GetIRODSPathDepth

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

func GetNumTasksForParallelTransfer(dataObjectLength int64) int

GetNumTasksForParallelTransfer returns the number transfer tasks to be used

func GetParentIRODSDirs

func GetParentIRODSDirs(p string) []string

GetParentDirs returns all parent dirs

func GetPasswordPadded

func GetPasswordPadded(newPassword string) string

GetPasswordPadded returns password with padding

func GetRelativeIRODSPath

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

GetRelativePath returns relative path

func HashLocalFile

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

func HashStrings

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

func Join

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

func MakeRandomString(size int) string

MakeRandomString returns a random string

func ObfuscateNewPassword

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

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

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

Scramble scrambles string

func ScrambleV2

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

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

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