github.com/0chain/gosdk@v1.17.11/zboxcore/sdk/downloader_filehandler.go (about)

     1  package sdk
     2  
     3  type fileHandlerDownloader struct {
     4  	baseDownloader
     5  }
     6  
     7  func (d *fileHandlerDownloader) Start(status StatusCallback, isFinal bool) error {
     8  	if d.isThumbnailDownload {
     9  		if d.isViewer {
    10  			return d.allocationObj.DownloadThumbnailToFileHandlerFromAuthTicket(d.fileHandler,
    11  				d.authTicket, d.lookupHash, d.fileName, d.verifyDownload, status, isFinal)
    12  		}
    13  
    14  		return d.allocationObj.DownloadThumbnailToFileHandler(d.fileHandler,
    15  			d.remotePath, d.verifyDownload, status, isFinal, d.reqOpts...)
    16  	} else if d.isBlockDownload {
    17  		if d.isViewer {
    18  			return d.allocationObj.DownloadByBlocksToFileHandlerFromAuthTicket(d.fileHandler,
    19  				d.authTicket, d.lookupHash, d.startBlock, d.endBlock, d.blocksPerMarker,
    20  				d.fileName, d.verifyDownload, status, isFinal)
    21  		}
    22  
    23  		return d.allocationObj.DownloadByBlocksToFileHandler(d.fileHandler,
    24  			d.remotePath, d.startBlock, d.endBlock, d.blocksPerMarker,
    25  			d.verifyDownload, status, isFinal, d.reqOpts...)
    26  	}
    27  	if d.isViewer {
    28  		return d.allocationObj.DownloadFileToFileHandlerFromAuthTicket(d.fileHandler,
    29  			d.authTicket, d.lookupHash, d.fileName, d.verifyDownload, status, isFinal)
    30  	}
    31  
    32  	return d.allocationObj.DownloadFileToFileHandler(d.fileHandler,
    33  		d.remotePath, d.verifyDownload, status, isFinal, d.reqOpts...)
    34  }