/** * Creates a file in the system with a pre-defined underfsPath. It also creates necessary folders * along the path. * * TODO(hy): It should not create necessary path. * * @param path the path of the file in Tachyon * @param ufsPath the path of the file in the underfs * @return The unique file id. It returns -1 if the creation failed * @throws IOException if the operation fails */ public synchronized long createFile(TachyonURI path, TachyonURI ufsPath) throws IOException { return createFile(path, ufsPath, -1, true); }
/** * Creates a file in the system. It also creates necessary folders along the path. * * TODO(hy): It should not create necessary path. * * @param path the path of the file * @param blockSizeByte the block size of the file * @return The unique file id. It returns -1 if the creation failed * @throws IOException if the operation fails */ public synchronized long createFile(TachyonURI path, long blockSizeByte) throws IOException { if (blockSizeByte > (long) Constants.GB * 2) { throw new IOException("Block size must be less than 2GB: " + blockSizeByte); } return createFile(path, TachyonURI.EMPTY_URI, blockSizeByte, true); }
/** * Creates a file with the default block size (1GB) in the system. It also creates necessary * folders along the path. * * TODO(hy): It should not create necessary path. * * @param path the path of the file * @return The unique file id. It returns -1 if the creation failed * @throws IOException if the operation fails */ public synchronized long createFile(TachyonURI path) throws IOException { long defaultBlockSize = mTachyonConf.getBytes(Constants.USER_BLOCK_SIZE_BYTES_DEFAULT); return createFile(path, defaultBlockSize); }