/** * Constructs a new {@link RunOperation} object. * * @param alluxioConf Alluxio configuration */ public RunOperation(AlluxioConfiguration alluxioConf) { mFileSystem = FileSystem.Factory.get(alluxioConf); }
/** * Tests whether the path is a directory. * * @param status the {@link URIStatus} status as the input of the command * @return true if the path is a directory or false if it is not a directory */ private boolean isDir(URIStatus status) { return status.isFolder(); }
/** * Creates a new instance of {@link alluxio.util.webui.UIFileInfo}. * * @param info underlying {@link FileInfo} */ public UIFileInfo(FileInfo info) { this(new URIStatus(info)); }
/** * Creates a {@link FileSystemContext} with a null subject. * * @param alluxioConf Alluxio configuration * @return an instance of file system context with no subject associated */ public static FileSystemContext create(AlluxioConfiguration alluxioConf) { return create(null, alluxioConf); }
@Override public void run() { FileSystemMasterClient client = mFsCtx.acquireMasterClient(); mFsCtx.releaseMasterClient(client); } }
@Override public void cancel() throws IOException { mCanceled = true; close(); }
@Override public void close() throws IOException { if (mClosed) { return; } mInputStream.close(); mClosed = true; }
@Override public void close() throws IOException { context.releaseBlockWorkerClient(address, blockWorker); } });
/** * Releases a file system master client into the file system master client pool. * * @param masterClient a file system master client to release */ public void releaseMasterClient(FileSystemMasterClient masterClient) { mFileSystemMasterClientPool.release(masterClient); }
/** * Creates a {@link FileOutStream} for test. * * @param path the file path * @param options the set of options specific to this operation * @return a {@link FileOutStream} */ private FileOutStream createTestStream(AlluxioURI path, OutStreamOptions options) throws IOException { return new FileOutStream(path, options, mFileSystemContext); } }
/** * @return if there is a local worker running the same machine */ public synchronized boolean hasLocalWorker() throws IOException { if (!mLocalWorkerInitialized) { initializeLocalWorker(); } return mLocalWorker != null; }
@Override public void close() throws IOException { closeBlockInStream(mBlockInStream); closeBlockInStream(mCachedPositionedReadStream); }
/** * Tests whether the file is zero length. * * @param status the {@link URIStatus} status as the input of the command * @return true if the file is zero length or false if it is not zero length */ private boolean isZeroLengthFile(URIStatus status) { return !status.isFolder() && status.getLength() == 0; }
/** * Creates a {@link FileSystemContext} with the configuration loaded from site-properties. * * @param subject The subject to connect to Alluxio with * @return an instance of file system context with the given subject and site-properties config */ public static FileSystemContext create(Subject subject) { return create(subject, null); }
/** * @return a local worker running the same machine, or null if none is found */ public synchronized WorkerNetAddress getLocalWorker() throws IOException { if (!mLocalWorkerInitialized) { initializeLocalWorker(); } return mLocalWorker; }