github.com/cyverse/go-irodsclient@v0.13.2/irods/util/tasks.go (about) 1 package util 2 3 const ( 4 // TransferTaskMinLength is a minimum data length of a task for parallel data transfer 5 TransferTaskMinLength int64 = 32 * 1024 * 1024 // 32MB 6 // TransferTaskMaxNum is a maximum number of tasks for parallel data transfer 7 TransferTaskMaxNum int = 4 8 // TransferBlockSize is a block size of a task 9 TransferBlockSize int64 = 1024 * 1024 // 1MB 10 ) 11 12 // GetNumTasksForParallelTransfer returns the number transfer tasks to be used 13 func GetNumTasksForParallelTransfer(dataObjectLength int64) int { 14 if dataObjectLength <= TransferTaskMinLength { 15 return 1 16 } 17 18 numTasks := int(dataObjectLength / TransferTaskMinLength) 19 if dataObjectLength%TransferTaskMinLength > 0 { 20 numTasks++ 21 } 22 23 if numTasks <= 1 { 24 return 1 25 } else if numTasks > TransferTaskMaxNum { 26 // too many tasks 27 return TransferTaskMaxNum 28 } 29 30 return numTasks 31 } 32 33 // GetBlockSizeForParallelTransfer returns the block size 34 func GetBlockSizeForParallelTransfer(dataObjectLength int64) int64 { 35 return TransferBlockSize 36 }