Package org.apache.hadoop.fs
Class LocalFileSystem
java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.fs.FileSystem
org.apache.hadoop.fs.FilterFileSystem
org.apache.hadoop.fs.ChecksumFileSystem
org.apache.hadoop.fs.LocalFileSystem
- All Implemented Interfaces:
Closeable,AutoCloseable,Configurable,BulkDeleteSource,org.apache.hadoop.fs.PathCapabilities,org.apache.hadoop.security.token.DelegationTokenIssuer
Implement the FileSystem API for the checksumed local filesystem.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.fs.FileSystem
org.apache.hadoop.fs.FileSystem.DirectoryEntries, org.apache.hadoop.fs.FileSystem.DirListingIterator<T extends FileStatus>, org.apache.hadoop.fs.FileSystem.Statistics -
Field Summary
Fields inherited from class org.apache.hadoop.fs.FilterFileSystem
fs, swapSchemeFields inherited from class org.apache.hadoop.fs.FileSystem
DEFAULT_FS, FS_DEFAULT_NAME_KEY, LOG, SHUTDOWN_HOOK_PRIORITY, statistics, TRASH_PREFIX, USER_HOME_PREFIXFields inherited from interface org.apache.hadoop.security.token.DelegationTokenIssuer
TOKEN_LOG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcopyFromLocalFile(boolean delSrc, Path src, Path dst) The src file is on the local disk.voidcopyToLocalFile(boolean delSrc, Path src, Path dst) The src file is under FS, and the dst is on the local disk.voidcreateSymlink(Path target, Path link, boolean createParent) getRaw()Return the protocol scheme for the FileSystem.voidinitialize(URI name, Configuration conf) Called after a new FileSystem instance is constructed.pathToFile(Path path) Convert a path to a File.booleanreportChecksumFailure(Path p, FSDataInputStream in, long inPos, FSDataInputStream sums, long sumsPos) Moves files to a bad file directory on the same device, so that their storage will not be reused.booleanMethods inherited from class org.apache.hadoop.fs.ChecksumFileSystem
append, appendFile, completeLocalOutput, concat, copyToLocalFile, create, create, createFile, createNonRecursive, createNonRecursive, delete, getApproxChkSumLength, getBytesPerSum, getChecksumFile, getChecksumFileLength, getChecksumLength, getRawFileSystem, getVerifyChecksum, hasPathCapability, isChecksumFile, listLocatedStatus, listStatus, listStatusIterator, mkdirs, modifyAclEntries, open, openFile, openFileWithOptions, removeAcl, removeAclEntries, removeDefaultAcl, rename, setAcl, setConf, setOwner, setPermission, setReplication, setVerifyChecksum, setWriteChecksum, startLocalOutput, truncateMethods inherited from class org.apache.hadoop.fs.FilterFileSystem
access, canonicalizeUri, checkPath, close, copyFromLocalFile, copyFromLocalFile, createPathHandle, createSnapshot, deleteSnapshot, getAclStatus, getAllStoragePolicies, getCanonicalUri, getChildFileSystems, getConf, getDefaultBlockSize, getDefaultBlockSize, getDefaultReplication, getDefaultReplication, getEnclosingRoot, getFileBlockLocations, getFileChecksum, getFileChecksum, getFileStatus, getHomeDirectory, getInitialWorkingDirectory, getServerDefaults, getServerDefaults, getStatus, getStoragePolicy, getTrashRoot, getTrashRoots, getUri, getUsed, getUsed, getWorkingDirectory, getXAttr, getXAttrs, getXAttrs, listCorruptFileBlocks, listLocatedStatus, listXAttrs, makeQualified, mkdirs, msync, open, openFile, openFileWithOptions, primitiveCreate, primitiveMkdir, removeXAttr, rename, renameSnapshot, resolveLink, resolvePath, satisfyStoragePolicy, setStoragePolicy, setTimes, setWorkingDirectory, setXAttr, setXAttr, unsetStoragePolicyMethods inherited from class org.apache.hadoop.fs.FileSystem
append, append, append, append, areSymlinksEnabled, cancelDeleteOnExit, clearStatistics, closeAll, closeAllForUGI, copyFromLocalFile, copyToLocalFile, copyToLocalFile, create, create, create, create, create, create, create, create, create, create, create, createBulkDelete, createDataInputStreamBuilder, createDataInputStreamBuilder, createDataOutputStreamBuilder, createMultipartUploader, createNewFile, createNonRecursive, createSnapshot, delete, deleteOnExit, enableSymlinks, exists, fixRelativePart, get, get, get, getAdditionalTokenIssuers, getAllStatistics, getBlockSize, getCanonicalServiceName, getContentSummary, getDefaultPort, getDefaultUri, getDelegationToken, getFileBlockLocations, getFileSystemClass, getFSofPath, getGlobalStorageStatistics, getLength, getLocal, getName, getNamed, getPathHandle, getQuotaUsage, getReplication, getStatistics, getStatistics, getStatus, getStorageStatistics, globStatus, globStatus, isDirectory, isFile, listFiles, listStatus, listStatus, listStatus, listStatusBatch, mkdirs, moveFromLocalFile, moveFromLocalFile, moveToLocalFile, newInstance, newInstance, newInstance, newInstanceLocal, open, open, primitiveMkdir, printStatistics, processDeleteOnExit, setDefaultUri, setDefaultUri, setQuota, setQuotaByStorageTypeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.security.token.DelegationTokenIssuer
addDelegationTokens
-
Constructor Details
-
LocalFileSystem
public LocalFileSystem() -
LocalFileSystem
-
-
Method Details
-
initialize
Description copied from class:FilterFileSystemCalled after a new FileSystem instance is constructed.- Overrides:
initializein classFilterFileSystem- Parameters:
name- a uri whose authority section names the host, port, etc. for this FileSystemconf- the configuration- Throws:
IOException- on any failure to initialize this instance.
-
getScheme
Return the protocol scheme for the FileSystem.- Overrides:
getSchemein classFileSystem- Returns:
file
-
getRaw
-
pathToFile
Convert a path to a File.- Parameters:
path- the path.- Returns:
- file.
-
copyFromLocalFile
Description copied from class:FilterFileSystemThe src file is on the local disk. Add it to FS at the given dst name. delSrc indicates if the source should be removed- Overrides:
copyFromLocalFilein classChecksumFileSystem- Parameters:
delSrc- whether to delete the srcsrc- pathdst- path- Throws:
IOException- IO failure.
-
copyToLocalFile
Description copied from class:ChecksumFileSystemThe src file is under FS, and the dst is on the local disk. Copy it from FS control to the local dst name.- Overrides:
copyToLocalFilein classChecksumFileSystem- Parameters:
delSrc- whether to delete the srcsrc- path src file in the remote filesystemdst- path local destination- Throws:
IOException- IO failure
-
reportChecksumFailure
public boolean reportChecksumFailure(Path p, FSDataInputStream in, long inPos, FSDataInputStream sums, long sumsPos) Moves files to a bad file directory on the same device, so that their storage will not be reused.- Overrides:
reportChecksumFailurein classChecksumFileSystem- Parameters:
p- the file name containing the errorin- the stream open on the fileinPos- the position of the beginning of the bad data in the filesums- the stream open on the checksum filesumsPos- the position of the beginning of the bad data in the checksum file- Returns:
- if retry is necessary
-
supportsSymlinks
public boolean supportsSymlinks()Description copied from class:FileSystem- Overrides:
supportsSymlinksin classFilterFileSystem- Returns:
- if support symlinkls true, not false.
-
createSymlink
Description copied from class:FileSystem- Overrides:
createSymlinkin classFilterFileSystem- Parameters:
target- target path.link- link.createParent- create parent.- Throws:
AccessControlException- if access is denied.FileAlreadyExistsException- when the path does not exist.FileNotFoundException- when the path does not exist.ParentNotDirectoryException- if the parent path of dest is not a directory.UnsupportedFileSystemException- if there was no known implementation for the scheme.IOException- raised on errors performing I/O.
-
getFileLinkStatus
Description copied from class:FileSystem- Overrides:
getFileLinkStatusin classFilterFileSystem- Parameters:
f- the path.- Returns:
- file status
- Throws:
AccessControlException- if access is denied.FileNotFoundException- when the path does not exist.IOException- raised on errors performing I/O.UnsupportedFileSystemException- if there was no known implementation for the scheme.
-
getLinkTarget
Description copied from class:FileSystem- Overrides:
getLinkTargetin classFilterFileSystem- Parameters:
f- the path.- Returns:
- the path.
- Throws:
IOException- IO failure.
-