Class SegmentFetcherFactory
- java.lang.Object
-
- org.apache.pinot.common.utils.fetcher.SegmentFetcherFactory
-
public class SegmentFetcherFactory extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidfetchAndDecryptSegmentToLocal(String uri, File dest, String crypterName)Fetches a segment from a URI location to a local file and decrypts it if neededstatic FilefetchAndStreamUntarToLocal(String uri, File tempRootDir, long maxStreamRateInByte)Fetches a segment from URI location to local and untar it in a streamed manner.static voidfetchSegmentToLocal(String uri, File dest)Fetches a segment from URI location to local.static voidfetchSegmentToLocal(URI uri, File dest)Fetches a segment from URI location to local.static SegmentFetcherFactorygetInstance()static SegmentFetchergetSegmentFetcher(String protocol)Returns the segment fetcher associated with the given protocol, or the default segment fetcher (HttpSegmentFetcherfor "http" and "https",PinotFSSegmentFetcherfor other protocols).static voidinit(PinotConfiguration config)Initializes the segment fetcher factory.
-
-
-
Method Detail
-
getInstance
public static SegmentFetcherFactory getInstance()
-
init
public static void init(PinotConfiguration config) throws Exception
Initializes the segment fetcher factory. This method should only be called once.- Throws:
Exception
-
getSegmentFetcher
public static SegmentFetcher getSegmentFetcher(String protocol)
Returns the segment fetcher associated with the given protocol, or the default segment fetcher (HttpSegmentFetcherfor "http" and "https",PinotFSSegmentFetcherfor other protocols).
-
fetchSegmentToLocal
public static void fetchSegmentToLocal(URI uri, File dest) throws Exception
Fetches a segment from URI location to local.- Throws:
Exception
-
fetchSegmentToLocal
public static void fetchSegmentToLocal(String uri, File dest) throws Exception
Fetches a segment from URI location to local.- Throws:
Exception
-
fetchAndStreamUntarToLocal
public static File fetchAndStreamUntarToLocal(String uri, File tempRootDir, long maxStreamRateInByte) throws Exception
Fetches a segment from URI location to local and untar it in a streamed manner.- Parameters:
uri- URItempRootDir- Tmp dir to downloadmaxStreamRateInByte- limit the rate to write download-untar stream to disk, in bytes -1 for no disk write limit, 0 for limit the writing to min(untar, download) rate- Returns:
- the untared directory
- Throws:
Exception
-
-