|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.conf.Configured
org.apache.hadoop.fs.FileSystem
org.apache.hadoop.fs.HarFileSystem
public class HarFileSystem
This is an implementation of the Hadoop Archive Filesystem. This archive Filesystem has index files of the form _index* and has contents of the form part-*. The index files store the indexes of the real files. The index files are of the form _masterindex and _index. The master index is a level of indirection in to the index file to make the look ups faster. the index file is sorted with hash code of the paths that it contains and the master index contains pointers to the positions in index for ranges of hashcodes.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.apache.hadoop.fs.FileSystem |
|---|
FileSystem.Statistics |
| Field Summary | |
|---|---|
static int |
METADATA_CACHE_ENTRIES_DEFAULT
|
static String |
METADATA_CACHE_ENTRIES_KEY
|
static int |
VERSION
|
| Fields inherited from class org.apache.hadoop.fs.FileSystem |
|---|
DEFAULT_FS, FS_DEFAULT_NAME_KEY, SHUTDOWN_HOOK_PRIORITY, statistics |
| Constructor Summary | |
|---|---|
HarFileSystem()
public construction of harfilesystem |
|
HarFileSystem(FileSystem fs)
Constructor to create a HarFileSystem with an underlying filesystem. |
|
| Method Summary | |
|---|---|
FSDataOutputStream |
append(Path f)
Append to an existing file (optional operation). |
FSDataOutputStream |
append(Path f,
int bufferSize,
Progressable progress)
Append to an existing file (optional operation). |
protected URI |
canonicalizeUri(URI uri)
Canonicalize the given URI. |
protected void |
checkPath(Path path)
Check that a Path belongs to this FileSystem. |
void |
close()
No more filesystem operations are needed. |
void |
completeLocalOutput(Path fsOutputFile,
Path tmpLocalFile)
not implemented. |
void |
copyFromLocalFile(boolean delSrc,
boolean overwrite,
Path[] srcs,
Path dst)
The src files are on the local disk. |
void |
copyFromLocalFile(boolean delSrc,
boolean overwrite,
Path src,
Path dst)
not implemented. |
void |
copyToLocalFile(boolean delSrc,
Path src,
Path dst)
copies the file in the har filesystem to a local file. |
FSDataOutputStream |
create(Path f,
FsPermission permission,
boolean overwrite,
int bufferSize,
short replication,
long blockSize,
Progressable progress)
Create an FSDataOutputStream at the indicated Path with write-progress reporting. |
FSDataOutputStream |
createNonRecursive(Path f,
boolean overwrite,
int bufferSize,
short replication,
long blockSize,
Progressable progress)
Opens an FSDataOutputStream at the indicated Path with write-progress reporting. |
boolean |
delete(Path f,
boolean recursive)
Not implemented. |
protected URI |
getCanonicalUri()
Used for delegation token related functionality. |
FileSystem[] |
getChildFileSystems()
Used for delegation token related functionality. |
Configuration |
getConf()
Return the configuration used by this object. |
long |
getDefaultBlockSize()
Return the number of bytes that large input files should be optimally be split into to minimize i/o time. |
long |
getDefaultBlockSize(Path f)
Return the number of bytes that large input files should be optimally be split into to minimize i/o time. |
short |
getDefaultReplication()
Get the default replication. |
short |
getDefaultReplication(Path f)
Get the default replication for a path. |
BlockLocation[] |
getFileBlockLocations(FileStatus file,
long start,
long len)
Get block locations from the underlying fs and fix their offsets and lengths. |
FileChecksum |
getFileChecksum(Path f,
long length)
Get the checksum of a file, from the beginning of the file till the specific length. |
FileStatus |
getFileStatus(Path f)
return the filestatus of files in har archive. |
static int |
getHarHash(Path p)
the hash of the path p inside the filesystem |
int |
getHarVersion()
|
Path |
getHomeDirectory()
return the top level archive path. |
Path |
getInitialWorkingDirectory()
Note: with the new FilesContext class, getWorkingDirectory() will be removed. |
String |
getScheme()
Return the protocol scheme for the FileSystem. |
FsServerDefaults |
getServerDefaults()
Return a set of server default configuration values |
FsServerDefaults |
getServerDefaults(Path f)
Return a set of server default configuration values |
FsStatus |
getStatus(Path p)
Returns a status object describing the use and capacity of the file system. |
URI |
getUri()
Returns the uri of this filesystem. |
long |
getUsed()
Return the total size of all files in the filesystem. |
Path |
getWorkingDirectory()
return the top level archive. |
void |
initialize(URI name,
Configuration conf)
Initialize a Har filesystem per har archive. |
FileStatus[] |
listStatus(Path f)
liststatus returns the children of a directory after looking up the index files. |
Path |
makeQualified(Path path)
Make sure that a path specifies a FileSystem. |
boolean |
mkdirs(Path f,
FsPermission permission)
not implemented. |
FSDataInputStream |
open(Path f,
int bufferSize)
Returns a har input stream which fakes end of file. |
boolean |
rename(Path src,
Path dst)
Renames Path src to Path dst. |
Path |
resolvePath(Path p)
Return the fully-qualified path of path f resolving the path through any symlinks or mount point |
void |
setOwner(Path p,
String username,
String groupname)
not implemented. |
void |
setPermission(Path p,
FsPermission permission)
Not implemented. |
boolean |
setReplication(Path src,
short replication)
Not implemented. |
void |
setTimes(Path p,
long mtime,
long atime)
Set access time of a file |
void |
setWorkingDirectory(Path newDir)
Set the current working directory for the given file system. |
Path |
startLocalOutput(Path fsOutputFile,
Path tmpLocalFile)
not implemented. |
| Methods inherited from class org.apache.hadoop.conf.Configured |
|---|
setConf |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String METADATA_CACHE_ENTRIES_KEY
public static final int METADATA_CACHE_ENTRIES_DEFAULT
public static final int VERSION
| Constructor Detail |
|---|
public HarFileSystem()
public HarFileSystem(FileSystem fs)
fs - underlying file system| Method Detail |
|---|
public String getScheme()
getScheme in class FileSystemhar
public void initialize(URI name,
Configuration conf)
throws IOException
initialize in class FileSystemname - a uri whose authority section names the host, port, etc.
for this FileSystemconf - the configuration
IOExceptionpublic Configuration getConf()
Configurable
getConf in interface ConfigurablegetConf in class Configured
public int getHarVersion()
throws IOException
IOExceptionpublic Path getWorkingDirectory()
getWorkingDirectory in class FileSystempublic Path getInitialWorkingDirectory()
FileSystem
getInitialWorkingDirectory in class FileSystem
public FsStatus getStatus(Path p)
throws IOException
FileSystem
getStatus in class FileSystemp - Path for which status should be obtained. null means
the default partition.
IOException - see specific implementationprotected URI getCanonicalUri()
getCanonicalUri in class FileSystemFileSystem.canonicalizeUri(URI)protected URI canonicalizeUri(URI uri)
FileSystem
canonicalizeUri in class FileSystemNetUtils.getCanonicalUri(URI, int)public URI getUri()
getUri in class FileSystemprotected void checkPath(Path path)
FileSystem
checkPath in class FileSystempath - to check
public Path resolvePath(Path p)
throws IOException
FileSystem
resolvePath in class FileSystemp - path to be resolved
FileNotFoundException
IOExceptionpublic Path makeQualified(Path path)
FileSystem
makeQualified in class FileSystempath - to use
public BlockLocation[] getFileBlockLocations(FileStatus file,
long start,
long len)
throws IOException
getFileBlockLocations in class FileSystemfile - the input file status to get block locationsstart - the start of the desired range in the contained filelen - the length of the desired range
IOExceptionpublic static int getHarHash(Path p)
p - the path in the harfilesystem
public FileStatus getFileStatus(Path f)
throws IOException
getFileStatus in class FileSystemf - the path in har filesystem
IOException
FileNotFoundException - when the path does not exist;
IOException see specific implementation
public FileChecksum getFileChecksum(Path f,
long length)
FileSystem
getFileChecksum in class FileSystemf - The file pathlength - The length of the file range for checksum calculation
public FSDataInputStream open(Path f,
int bufferSize)
throws IOException
open in class FileSystemf - the file name to openbufferSize - the size of the buffer to be used.
IOExceptionpublic FileSystem[] getChildFileSystems()
public FSDataOutputStream create(Path f,
FsPermission permission,
boolean overwrite,
int bufferSize,
short replication,
long blockSize,
Progressable progress)
throws IOException
FileSystem
create in class FileSystemf - the file name to openoverwrite - if a file with this name already exists, then if true,
the file will be overwritten, and if false an error will be thrown.bufferSize - the size of the buffer to be used.replication - required block replication for the file.
IOExceptionFileSystem.setPermission(Path, FsPermission)
public FSDataOutputStream createNonRecursive(Path f,
boolean overwrite,
int bufferSize,
short replication,
long blockSize,
Progressable progress)
throws IOException
FileSystem
createNonRecursive in class FileSystemf - the file name to openoverwrite - if a file with this name already exists, then if true,
the file will be overwritten, and if false an error will be thrown.bufferSize - the size of the buffer to be used.replication - required block replication for the file.
IOExceptionFileSystem.setPermission(Path, FsPermission)
public FSDataOutputStream append(Path f,
int bufferSize,
Progressable progress)
throws IOException
FileSystem
append in class FileSystemf - the existing file to be appended.bufferSize - the size of the buffer to be used.progress - for reporting progress if it is not null.
IOException
public void close()
throws IOException
FileSystem
close in interface Closeableclose in class FileSystemIOException
public boolean setReplication(Path src,
short replication)
throws IOException
setReplication in class FileSystemsrc - file namereplication - new replication
IOException
public boolean rename(Path src,
Path dst)
throws IOException
FileSystem
rename in class FileSystemsrc - path to be renameddst - new path after rename
IOException - on failure
public FSDataOutputStream append(Path f)
throws IOException
FileSystem
append in class FileSystemf - the existing file to be appended.
IOException
public boolean delete(Path f,
boolean recursive)
throws IOException
delete in class FileSystemf - the path to delete.recursive - if path is a directory and set to
true, the directory is deleted else throws an exception. In
case of a file the recursive can be set to either true or false.
IOException
public FileStatus[] listStatus(Path f)
throws IOException
listStatus in class FileSystemf - given path
FileNotFoundException - when the path does not exist;
IOException see specific implementation
IOExceptionpublic Path getHomeDirectory()
getHomeDirectory in class FileSystempublic void setWorkingDirectory(Path newDir)
FileSystem
setWorkingDirectory in class FileSystem
public boolean mkdirs(Path f,
FsPermission permission)
throws IOException
mkdirs in class FileSystemf - path to createpermission - to apply to f
IOException
public void copyFromLocalFile(boolean delSrc,
boolean overwrite,
Path src,
Path dst)
throws IOException
copyFromLocalFile in class FileSystemdelSrc - whether to delete the srcoverwrite - whether to overwrite an existing filesrc - pathdst - path
IOException
public void copyFromLocalFile(boolean delSrc,
boolean overwrite,
Path[] srcs,
Path dst)
throws IOException
FileSystem
copyFromLocalFile in class FileSystemdelSrc - whether to delete the srcoverwrite - whether to overwrite an existing filesrcs - array of paths which are sourcedst - path
IOException
public void copyToLocalFile(boolean delSrc,
Path src,
Path dst)
throws IOException
copyToLocalFile in class FileSystemdelSrc - whether to delete the srcsrc - pathdst - path
IOException
public Path startLocalOutput(Path fsOutputFile,
Path tmpLocalFile)
throws IOException
startLocalOutput in class FileSystemfsOutputFile - path of output filetmpLocalFile - path of local tmp file
IOException
public void completeLocalOutput(Path fsOutputFile,
Path tmpLocalFile)
throws IOException
completeLocalOutput in class FileSystemfsOutputFile - path of output filetmpLocalFile - path to local tmp file
IOException
public void setOwner(Path p,
String username,
String groupname)
throws IOException
setOwner in class FileSystemp - The pathusername - If it is null, the original username remains unchanged.groupname - If it is null, the original groupname remains unchanged.
IOException
public void setTimes(Path p,
long mtime,
long atime)
throws IOException
FileSystem
setTimes in class FileSystemp - The pathmtime - Set the modification time of this file.
The number of milliseconds since Jan 1, 1970.
A value of -1 means that this call should not set modification time.atime - Set the access time of this file.
The number of milliseconds since Jan 1, 1970.
A value of -1 means that this call should not set access time.
IOException
public void setPermission(Path p,
FsPermission permission)
throws IOException
setPermission in class FileSystemIOException
public FsServerDefaults getServerDefaults()
throws IOException
FileSystem
getServerDefaults in class FileSystemIOException
public FsServerDefaults getServerDefaults(Path f)
throws IOException
FileSystem
getServerDefaults in class FileSystemf - path is used to identify an FS since an FS could have
another FS that it could be delegating the call to
IOException
public long getUsed()
throws IOException
FileSystem
getUsed in class FileSystemIOExceptionpublic long getDefaultBlockSize()
FileSystem
getDefaultBlockSize in class FileSystempublic long getDefaultBlockSize(Path f)
FileSystem
getDefaultBlockSize in class FileSystemf - path of file
public short getDefaultReplication()
FileSystem
getDefaultReplication in class FileSystempublic short getDefaultReplication(Path f)
FileSystem
getDefaultReplication in class FileSystemf - of the file
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||