|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.io.FileLink
@InterfaceAudience.Private public class FileLink
The FileLink is a sort of hardlink, that allows to access a file given a set of locations.
The Problem:
HFileLink
and the HLogLink
.
Back-references:
To help the CleanerChore
to keep track of the links to a particular file,
during the FileLink creation, a new file is placed inside a back-reference directory.
There's one back-reference directory for each file that has links,
and in the directory there's one file per link.
HFileLink Example
Field Summary | |
---|---|
static String |
BACK_REFERENCES_DIRECTORY_PREFIX
Define the Back-reference directory name prefix: .links- |
Constructor Summary | |
---|---|
protected |
FileLink()
|
|
FileLink(Collection<org.apache.hadoop.fs.Path> locations)
|
|
FileLink(org.apache.hadoop.fs.Path originPath,
org.apache.hadoop.fs.Path... alternativePaths)
|
Method Summary | |
---|---|
org.apache.hadoop.fs.Path |
getAvailablePath(org.apache.hadoop.fs.FileSystem fs)
|
static String |
getBackReferenceFileName(org.apache.hadoop.fs.Path dirPath)
Get the referenced file name from the reference link directory path. |
static org.apache.hadoop.fs.Path |
getBackReferencesDir(org.apache.hadoop.fs.Path storeDir,
String fileName)
Get the directory to store the link back references |
org.apache.hadoop.fs.FileStatus |
getFileStatus(org.apache.hadoop.fs.FileSystem fs)
Get the FileStatus of the referenced file. |
org.apache.hadoop.fs.Path[] |
getLocations()
|
static boolean |
isBackReferencesDir(org.apache.hadoop.fs.Path dirPath)
Checks if the specified directory path is a back reference links folder. |
org.apache.hadoop.fs.FSDataInputStream |
open(org.apache.hadoop.fs.FileSystem fs)
Open the FileLink for read. |
org.apache.hadoop.fs.FSDataInputStream |
open(org.apache.hadoop.fs.FileSystem fs,
int bufferSize)
Open the FileLink for read. |
protected void |
setLocations(org.apache.hadoop.fs.Path originPath,
org.apache.hadoop.fs.Path... alternativePaths)
NOTE: This method must be used only in the constructor! It creates a List with the specified locations for the link. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String BACK_REFERENCES_DIRECTORY_PREFIX
Constructor Detail |
---|
protected FileLink()
public FileLink(org.apache.hadoop.fs.Path originPath, org.apache.hadoop.fs.Path... alternativePaths)
originPath
- Original location of the file to linkalternativePaths
- Alternative locations to look for the linked filepublic FileLink(Collection<org.apache.hadoop.fs.Path> locations)
locations
- locations to look for the linked fileMethod Detail |
---|
public org.apache.hadoop.fs.Path[] getLocations()
public String toString()
toString
in class Object
public org.apache.hadoop.fs.Path getAvailablePath(org.apache.hadoop.fs.FileSystem fs) throws IOException
IOException
public org.apache.hadoop.fs.FileStatus getFileStatus(org.apache.hadoop.fs.FileSystem fs) throws IOException
fs
- FileSystem
on which to get the file status
IOException
- on unexpected error.public org.apache.hadoop.fs.FSDataInputStream open(org.apache.hadoop.fs.FileSystem fs) throws IOException
It uses a wrapper of FSDataInputStream that is agnostic to the location of the file, even if the file switches between locations.
fs
- FileSystem
on which to open the FileLink
IOException
- on unexpected error.public org.apache.hadoop.fs.FSDataInputStream open(org.apache.hadoop.fs.FileSystem fs, int bufferSize) throws IOException
It uses a wrapper of FSDataInputStream that is agnostic to the location of the file, even if the file switches between locations.
fs
- FileSystem
on which to open the FileLinkbufferSize
- the size of the buffer to be used.
IOException
- on unexpected error.protected void setLocations(org.apache.hadoop.fs.Path originPath, org.apache.hadoop.fs.Path... alternativePaths)
public static org.apache.hadoop.fs.Path getBackReferencesDir(org.apache.hadoop.fs.Path storeDir, String fileName)
To simplify the reference count process, during the FileLink creation a back-reference is added to the back-reference directory of the specified file.
storeDir
- Root directory for the link reference folderfileName
- File Name with links
public static String getBackReferenceFileName(org.apache.hadoop.fs.Path dirPath)
dirPath
- Link references directory path
public static boolean isBackReferencesDir(org.apache.hadoop.fs.Path dirPath)
dirPath
- Directory path to verify
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |