github.com/cyverse/go-irodsclient@v0.13.2/fs/fs_structfile.go (about) 1 package fs 2 3 import ( 4 irods_fs "github.com/cyverse/go-irodsclient/irods/fs" 5 "github.com/cyverse/go-irodsclient/irods/types" 6 "github.com/cyverse/go-irodsclient/irods/util" 7 ) 8 9 // ExtractStructFile extracts a struct file 10 func (fs *FileSystem) ExtractStructFile(path string, targetCollection string, resource string, dataType types.DataType, force bool, bulkReg bool) error { 11 irodsPath := util.GetCorrectIRODSPath(path) 12 targetIrodsPath := util.GetCorrectIRODSPath(targetCollection) 13 14 // we create a new connection for extraction because iRODS has a bug that does not clear file descriptors, causing SYS_OUT_OF_FILE_DESC error. 15 // create a new unmanaged connection and throw out after use. 16 conn, err := fs.metaSession.AcquireUnmanagedConnection() 17 if err != nil { 18 return err 19 } 20 21 // discard the connection after use to avoid file descriptor error. 22 defer fs.metaSession.DiscardConnection(conn) 23 24 err = irods_fs.ExtractStructFile(conn, irodsPath, targetIrodsPath, resource, dataType, force, bulkReg) 25 if err != nil { 26 return err 27 } 28 29 fs.invalidateCacheForDirExtract(targetIrodsPath) 30 fs.cachePropagation.PropagateDirExtract(targetIrodsPath) 31 32 return nil 33 }