@InterfaceAudience.Private @InterfaceStability.Stable public class ClientNamenodeProtocolTranslatorPB extends Object implements ProtocolMetaInterface, ClientProtocol, Closeable, ProtocolTranslator
GET_STATS_CAPACITY_IDX, GET_STATS_CORRUPT_BLOCKS_IDX, GET_STATS_MISSING_BLOCKS_IDX, GET_STATS_REMAINING_IDX, GET_STATS_UNDER_REPLICATED_IDX, GET_STATS_USED_IDX, versionID
Constructor and Description |
---|
ClientNamenodeProtocolTranslatorPB(ClientNamenodeProtocolPB proxy) |
Modifier and Type | Method and Description |
---|---|
void |
abandonBlock(ExtendedBlock b,
String src,
String holder)
The client can give up on a block by calling abandonBlock().
|
LocatedBlock |
addBlock(String src,
String clientName,
ExtendedBlock previous,
DatanodeInfo[] excludeNodes,
long fileId,
String[] favoredNodes)
A client that wants to write an additional block to the
indicated filename (which must currently be open for writing)
should call addBlock().
|
void |
allowSnapshot(String snapshotRoot)
Allow snapshot on a directory.
|
LocatedBlock |
append(String src,
String clientName)
Append to the end of the file.
|
void |
cancelDelegationToken(Token<DelegationTokenIdentifier> token)
Cancel an existing delegation token.
|
void |
close() |
boolean |
complete(String src,
String clientName,
ExtendedBlock last,
long fileId)
The client is done writing data to the given filename, and would
like to complete it.
|
void |
concat(String trg,
String[] srcs)
Moves blocks from srcs to trg and delete srcs
|
HdfsFileStatus |
create(String src,
FsPermission masked,
String clientName,
EnumSetWritable<CreateFlag> flag,
boolean createParent,
short replication,
long blockSize)
Create a new file entry in the namespace.
|
String |
createSnapshot(String snapshotRoot,
String snapshotName)
Create a snapshot
|
void |
createSymlink(String target,
String link,
FsPermission dirPerm,
boolean createParent)
Create symlink to a file or directory.
|
boolean |
delete(String src,
boolean recursive)
Delete the given file or directory from the file system.
|
void |
deleteSnapshot(String snapshotRoot,
String snapshotName)
Delete a specific snapshot of a snapshottable directory
|
void |
disallowSnapshot(String snapshotRoot)
Disallow snapshot on a directory.
|
void |
finalizeUpgrade()
Finalize previous upgrade.
|
void |
fsync(String src,
String client,
long lastBlockLength)
Write all metadata for this file into persistent storage.
|
LocatedBlock |
getAdditionalDatanode(String src,
ExtendedBlock blk,
DatanodeInfo[] existings,
DatanodeInfo[] excludes,
int numAdditionalNodes,
String clientName)
Get a datanode for an existing pipeline.
|
LocatedBlocks |
getBlockLocations(String src,
long offset,
long length)
Get locations of the blocks of the specified file within the specified range.
|
ContentSummary |
getContentSummary(String path)
Get
ContentSummary rooted at the specified directory. |
DataEncryptionKey |
getDataEncryptionKey() |
DatanodeInfo[] |
getDatanodeReport(HdfsConstants.DatanodeReportType type)
Get a report on the system's current datanodes.
|
Token<DelegationTokenIdentifier> |
getDelegationToken(Text renewer)
Get a valid Delegation Token.
|
HdfsFileStatus |
getFileInfo(String src)
Get the file info for a specific file or directory.
|
HdfsFileStatus |
getFileLinkInfo(String src)
Get the file info for a specific file or directory.
|
String |
getLinkTarget(String path)
Return the target of the given symlink.
|
DirectoryListing |
getListing(String src,
byte[] startAfter,
boolean needLocation)
Get a partial listing of the indicated directory
|
long |
getPreferredBlockSize(String filename)
Get the block size for the given file.
|
FsServerDefaults |
getServerDefaults()
Get server default values for a number of configuration params.
|
SnapshotDiffReport |
getSnapshotDiffReport(String snapshotRoot,
String fromSnapshot,
String toSnapshot)
Get the difference between two snapshots, or between a snapshot and the
current tree of a directory.
|
SnapshottableDirectoryStatus[] |
getSnapshottableDirListing()
Get listing of all the snapshottable directories
|
long[] |
getStats()
Get a set of statistics about the filesystem.
|
Object |
getUnderlyingProxyObject()
Return the proxy object underlying this protocol translator.
|
boolean |
isFileClosed(String src)
Get the close status of a file
|
boolean |
isMethodSupported(String methodName)
Checks whether the given method name is supported by the server.
|
CorruptFileBlocks |
listCorruptFileBlocks(String path,
String cookie) |
void |
metaSave(String filename)
Dumps namenode data structures into specified file.
|
boolean |
mkdirs(String src,
FsPermission masked,
boolean createParent)
Create a directory (or hierarchy of directories) with the given
name and permission.
|
boolean |
recoverLease(String src,
String clientName)
Start lease recovery.
|
void |
refreshNodes()
Tells the namenode to reread the hosts and exclude files.
|
boolean |
rename(String src,
String dst)
Rename an item in the file system namespace.
|
void |
rename2(String src,
String dst,
Options.Rename... options)
Rename src to dst.
|
void |
renameSnapshot(String snapshotRoot,
String snapshotOldName,
String snapshotNewName)
Rename a snapshot
|
long |
renewDelegationToken(Token<DelegationTokenIdentifier> token)
Renew an existing delegation token.
|
void |
renewLease(String clientName)
Client programs can cause stateful changes in the NameNode
that affect other clients.
|
void |
reportBadBlocks(LocatedBlock[] blocks)
The client wants to report corrupted blocks (blocks with specified
locations on datanodes).
|
boolean |
restoreFailedStorage(String arg)
Enable/Disable restore failed storage.
|
long |
rollEdits()
Roll the edit log.
|
void |
saveNamespace()
Save namespace image.
|
void |
setBalancerBandwidth(long bandwidth)
Tell all datanodes to use a new, non-persistent bandwidth value for
dfs.balance.bandwidthPerSec.
|
void |
setOwner(String src,
String username,
String groupname)
Set Owner of a path (i.e.
|
void |
setPermission(String src,
FsPermission permission)
Set permissions for an existing file/directory.
|
void |
setQuota(String path,
long namespaceQuota,
long diskspaceQuota)
Set the quota for a directory.
|
boolean |
setReplication(String src,
short replication)
Set replication for an existing file.
|
boolean |
setSafeMode(HdfsConstants.SafeModeAction action,
boolean isChecked)
Enter, leave or get safe mode.
|
void |
setTimes(String src,
long mtime,
long atime)
Sets the modification and access time of the file to the specified time.
|
LocatedBlock |
updateBlockForPipeline(ExtendedBlock block,
String clientName)
Get a new generation stamp together with an access token for
a block under construction
This method is called only when a client needs to recover a failed
pipeline or set up a pipeline for appending to a block.
|
void |
updatePipeline(String clientName,
ExtendedBlock oldBlock,
ExtendedBlock newBlock,
DatanodeID[] newNodes)
Update a pipeline for a block under construction
|
public ClientNamenodeProtocolTranslatorPB(ClientNamenodeProtocolPB proxy)
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public LocatedBlocks getBlockLocations(String src, long offset, long length) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException
ClientProtocol
Return LocatedBlocks
which contains
file length, blocks and their locations.
DataNode locations for each block are sorted by
the distance to the client's address.
The client will then have to contact one of the indicated DataNodes to obtain the actual data.
getBlockLocations
in interface ClientProtocol
src
- file nameoffset
- range start offsetlength
- range lengthAccessControlException
- If access is deniedFileNotFoundException
- If file src
does not existUnresolvedLinkException
- If src
contains a symlinkIOException
- If an I/O error occurredpublic FsServerDefaults getServerDefaults() throws IOException
ClientProtocol
getServerDefaults
in interface ClientProtocol
IOException
public HdfsFileStatus create(String src, FsPermission masked, String clientName, EnumSetWritable<CreateFlag> flag, boolean createParent, short replication, long blockSize) throws AccessControlException, AlreadyBeingCreatedException, DSQuotaExceededException, FileAlreadyExistsException, FileNotFoundException, NSQuotaExceededException, ParentNotDirectoryException, SafeModeException, UnresolvedLinkException, IOException
ClientProtocol
This will create an empty file specified by the source path. The path should reflect a full path originated at the root. The name-node does not have a notion of "current" directory for a client.
Once created, the file is visible and available for read to other clients.
Although, other clients cannot ClientProtocol.delete(String, boolean)
, re-create or
ClientProtocol.rename(String, String)
it until the file is completed
or explicitly as a result of lease expiration.
Blocks have a maximum size. Clients that intend to create
multi-block files must also use
ClientProtocol.addBlock(java.lang.String, java.lang.String, org.apache.hadoop.hdfs.protocol.ExtendedBlock, org.apache.hadoop.hdfs.protocol.DatanodeInfo[], long, java.lang.String[])
create
in interface ClientProtocol
src
- path of the file being created.masked
- masked permission.clientName
- name of the current client.flag
- indicates whether the file should be
overwritten if it already exists or create if it does not exist or append.createParent
- create missing parent directory if truereplication
- block replication factor.blockSize
- maximum block size.AccessControlException
- If access is deniedSnapshotAccessControlException
- if path is in RO snapshotAlreadyBeingCreatedException
- if the path does not exist.DSQuotaExceededException
- If file creation violates disk space
quota restrictionFileAlreadyExistsException
- If file src
already existsFileNotFoundException
- If parent of src
does not exist
and createParent
is falseNSQuotaExceededException
- If file creation violates name space
quota restrictionParentNotDirectoryException
- If parent of src
is not a
directory.SafeModeException
- create not allowed in safemodeUnresolvedLinkException
- If src
contains a symlinkIOException
- If an I/O error occurred
RuntimeExceptions:public LocatedBlock append(String src, String clientName) throws AccessControlException, DSQuotaExceededException, FileNotFoundException, SafeModeException, UnresolvedLinkException, IOException
ClientProtocol
append
in interface ClientProtocol
src
- path of the file being created.clientName
- name of the current client.AccessControlException
- if permission to append file is
denied by the system. As usually on the client side the exception will
be wrapped into RemoteException
.
Allows appending to an existing file if the server is
configured with the parameter dfs.support.append set to true, otherwise
throws an IOException.SnapshotAccessControlException
- if path is in RO snapshotDSQuotaExceededException
- If append violates disk space quota
restrictionFileNotFoundException
- If file src
is not foundSafeModeException
- append not allowed in safemodeUnresolvedLinkException
- If src
contains a symlinkIOException
- If an I/O error occurred.
RuntimeExceptions:public boolean setReplication(String src, short replication) throws AccessControlException, DSQuotaExceededException, FileNotFoundException, SafeModeException, UnresolvedLinkException, IOException
ClientProtocol
The NameNode sets replication to the new value and returns. The actual block replication is not expected to be performed during this method call. The blocks will be populated or removed in the background as the result of the routine block maintenance procedures.
setReplication
in interface ClientProtocol
src
- file namereplication
- new replicationAccessControlException
- If access is deniedSnapshotAccessControlException
- if path is in RO snapshotDSQuotaExceededException
- If replication violates disk space
quota restrictionFileNotFoundException
- If file src
is not foundSafeModeException
- not allowed in safemodeUnresolvedLinkException
- if src
contains a symlinkIOException
- If an I/O error occurredpublic void setPermission(String src, FsPermission permission) throws AccessControlException, FileNotFoundException, SafeModeException, UnresolvedLinkException, IOException
ClientProtocol
setPermission
in interface ClientProtocol
AccessControlException
- If access is deniedSnapshotAccessControlException
- if path is in RO snapshotFileNotFoundException
- If file src
is not foundSafeModeException
- not allowed in safemodeUnresolvedLinkException
- If src
contains a symlinkIOException
- If an I/O error occurredpublic void setOwner(String src, String username, String groupname) throws AccessControlException, FileNotFoundException, SafeModeException, UnresolvedLinkException, IOException
ClientProtocol
setOwner
in interface ClientProtocol
username
- If it is null, the original username remains unchanged.groupname
- If it is null, the original groupname remains unchanged.AccessControlException
- If access is deniedSnapshotAccessControlException
- if path is in RO snapshotFileNotFoundException
- If file src
is not foundSafeModeException
- not allowed in safemodeUnresolvedLinkException
- If src
contains a symlinkIOException
- If an I/O error occurredpublic void abandonBlock(ExtendedBlock b, String src, String holder) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException
ClientProtocol
abandonBlock
in interface ClientProtocol
AccessControlException
- If access is deniedFileNotFoundException
- file src
is not foundUnresolvedLinkException
- If src
contains a symlinkIOException
- If an I/O error occurredpublic LocatedBlock addBlock(String src, String clientName, ExtendedBlock previous, DatanodeInfo[] excludeNodes, long fileId, String[] favoredNodes) throws AccessControlException, FileNotFoundException, NotReplicatedYetException, SafeModeException, UnresolvedLinkException, IOException
ClientProtocol
addBlock
in interface ClientProtocol
src
- the file being createdclientName
- the name of the client that adds the blockprevious
- previous blockexcludeNodes
- a list of nodes that should not be
allocated for the current blockfileId
- the id uniquely identifying a filefavoredNodes
- the list of nodes where the client wants the blocks.
Nodes are identified by either host name or address.AccessControlException
- If access is deniedFileNotFoundException
- If file src
is not foundNotReplicatedYetException
- previous blocks of the file are not
replicated yet. Blocks cannot be added until replication
completes.SafeModeException
- create not allowed in safemodeUnresolvedLinkException
- If src
contains a symlinkIOException
- If an I/O error occurredpublic LocatedBlock getAdditionalDatanode(String src, ExtendedBlock blk, DatanodeInfo[] existings, DatanodeInfo[] excludes, int numAdditionalNodes, String clientName) throws AccessControlException, FileNotFoundException, SafeModeException, UnresolvedLinkException, IOException
ClientProtocol
getAdditionalDatanode
in interface ClientProtocol
src
- the file being writtenblk
- the block being writtenexistings
- the existing nodes in the pipelineexcludes
- the excluded nodesnumAdditionalNodes
- number of additional datanodesclientName
- the name of the clientAccessControlException
- If access is deniedFileNotFoundException
- If file src
is not foundSafeModeException
- create not allowed in safemodeUnresolvedLinkException
- If src
contains a symlinkIOException
- If an I/O error occurredpublic boolean complete(String src, String clientName, ExtendedBlock last, long fileId) throws AccessControlException, FileNotFoundException, SafeModeException, UnresolvedLinkException, IOException
ClientProtocol
complete
in interface ClientProtocol
src
- the file being createdclientName
- the name of the client that adds the blocklast
- the last block infofileId
- the id uniquely identifying a fileAccessControlException
- If access is deniedFileNotFoundException
- If file src
is not foundSafeModeException
- create not allowed in safemodeUnresolvedLinkException
- If src
contains a symlinkIOException
- If an I/O error occurredpublic void reportBadBlocks(LocatedBlock[] blocks) throws IOException
ClientProtocol
reportBadBlocks
in interface ClientProtocol
blocks
- Array of located blocks to reportIOException
public boolean rename(String src, String dst) throws UnresolvedLinkException, IOException
ClientProtocol
rename
in interface ClientProtocol
src
- existing file or directory name.dst
- new name.SnapshotAccessControlException
- if path is in RO snapshotIOException
- an I/O error occurredUnresolvedLinkException
public void rename2(String src, String dst, Options.Rename... options) throws AccessControlException, DSQuotaExceededException, FileAlreadyExistsException, FileNotFoundException, NSQuotaExceededException, ParentNotDirectoryException, SafeModeException, UnresolvedLinkException, IOException
ClientProtocol
Without OVERWRITE option, rename fails if the dst already exists. With OVERWRITE option, rename overwrites the dst, if it is a file or an empty directory. Rename fails if dst is a non-empty directory.
This implementation of rename is atomic.
rename2
in interface ClientProtocol
src
- existing file or directory name.dst
- new name.options
- Rename optionsAccessControlException
- If access is deniedSnapshotAccessControlException
- if path is in RO snapshotDSQuotaExceededException
- If rename violates disk space
quota restrictionFileAlreadyExistsException
- If dst
already exists and
options has Options.Rename.OVERWRITE
option
false.
FileNotFoundException
- If src
does not existNSQuotaExceededException
- If rename violates namespace
quota restrictionParentNotDirectoryException
- If parent of dst
is not a directorySafeModeException
- rename not allowed in safemodeUnresolvedLinkException
- If src
or
dst
contains a symlinkIOException
- If an I/O error occurredpublic void concat(String trg, String[] srcs) throws IOException, UnresolvedLinkException
ClientProtocol
concat
in interface ClientProtocol
trg
- existing filesrcs
- - list of existing files (same block size, same replication)IOException
- if some arguments are invalidUnresolvedLinkException
- if trg
or srcs
contains a symlinkSnapshotAccessControlException
- if path is in RO snapshotpublic boolean delete(String src, boolean recursive) throws AccessControlException, FileNotFoundException, SafeModeException, UnresolvedLinkException, IOException
ClientProtocol
same as delete but provides a way to avoid accidentally deleting non empty directories programmatically.
delete
in interface ClientProtocol
src
- existing namerecursive
- if true deletes a non empty directory recursively,
else throws an exception.AccessControlException
- If access is deniedSnapshotAccessControlException
- if path is in RO snapshotFileNotFoundException
- If file src
is not foundSafeModeException
- create not allowed in safemodeUnresolvedLinkException
- If src
contains a symlinkIOException
- If an I/O error occurredpublic boolean mkdirs(String src, FsPermission masked, boolean createParent) throws AccessControlException, FileAlreadyExistsException, FileNotFoundException, NSQuotaExceededException, ParentNotDirectoryException, SafeModeException, UnresolvedLinkException, IOException
ClientProtocol
mkdirs
in interface ClientProtocol
src
- The path of the directory being createdmasked
- The masked permission of the directory being createdcreateParent
- create missing parent directory if trueAccessControlException
- If access is deniedSnapshotAccessControlException
- if path is in RO snapshotFileAlreadyExistsException
- If src
already existsFileNotFoundException
- If parent of src
does not exist
and createParent
is falseNSQuotaExceededException
- If file creation violates quota restrictionParentNotDirectoryException
- If parent of src
is not a directorySafeModeException
- create not allowed in safemodeUnresolvedLinkException
- If src
contains a symlinkIOException
- If an I/O error occurred.
RunTimeExceptions:public DirectoryListing getListing(String src, byte[] startAfter, boolean needLocation) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException
ClientProtocol
getListing
in interface ClientProtocol
src
- the directory namestartAfter
- the name to start listing after encoded in java UTF8needLocation
- if the FileStatus should contain block locationsAccessControlException
- permission deniedFileNotFoundException
- file src
is not foundUnresolvedLinkException
- If src
contains a symlinkIOException
- If an I/O error occurredpublic void renewLease(String clientName) throws AccessControlException, IOException
ClientProtocol
So, the NameNode will revoke the locks and live file-creates for clients that it thinks have died. A client tells the NameNode that it is still alive by periodically calling renewLease(). If a certain amount of time passes since the last call to renewLease(), the NameNode assumes the client has died.
renewLease
in interface ClientProtocol
AccessControlException
- permission deniedIOException
- If an I/O error occurredpublic boolean recoverLease(String src, String clientName) throws IOException
ClientProtocol
recoverLease
in interface ClientProtocol
src
- path of the file to start lease recoveryclientName
- name of the current clientIOException
public long[] getStats() throws IOException
ClientProtocol
ClientProtocol.GET_STATS_CAPACITY_IDX
in place of
actual numbers to index into the array.getStats
in interface ClientProtocol
IOException
public DatanodeInfo[] getDatanodeReport(HdfsConstants.DatanodeReportType type) throws IOException
ClientProtocol
getDatanodeReport
in interface ClientProtocol
IOException
public long getPreferredBlockSize(String filename) throws IOException, UnresolvedLinkException
ClientProtocol
getPreferredBlockSize
in interface ClientProtocol
filename
- The name of the fileIOException
UnresolvedLinkException
- if the path contains a symlink.public boolean setSafeMode(HdfsConstants.SafeModeAction action, boolean isChecked) throws IOException
ClientProtocol
Safe mode is a name node state when it
Safe mode is entered automatically at name node startup.
Safe mode can also be entered manually using
setSafeMode(SafeModeAction.SAFEMODE_ENTER,false)
.
At startup the name node accepts data node reports collecting information about block locations. In order to leave safe mode it needs to collect a configurable percentage called threshold of blocks, which satisfy the minimal replication condition. The minimal replication condition is that each block must have at least dfs.namenode.replication.min replicas. When the threshold is reached the name node extends safe mode for a configurable amount of time to let the remaining data nodes to check in before it will start replicating missing blocks. Then the name node leaves safe mode.
If safe mode is turned on manually using
setSafeMode(SafeModeAction.SAFEMODE_ENTER,false)
then the name node stays in safe mode until it is manually turned off
using setSafeMode(SafeModeAction.SAFEMODE_LEAVE,false)
.
Current state of the name node can be verified using
setSafeMode(SafeModeAction.SAFEMODE_GET,false)
setSafeMode
in interface ClientProtocol
action
- isChecked
- If true then action will be done only in ActiveNN.IOException
public void saveNamespace() throws AccessControlException, IOException
ClientProtocol
Saves current namespace into storage directories and reset edits log. Requires superuser privilege and safe mode.
saveNamespace
in interface ClientProtocol
AccessControlException
- if the superuser privilege is violated.IOException
- if image creation failed.public long rollEdits() throws AccessControlException, IOException
ClientProtocol
rollEdits
in interface ClientProtocol
AccessControlException
- if the superuser privilege is violatedIOException
- if log roll failspublic boolean restoreFailedStorage(String arg) throws AccessControlException, IOException
ClientProtocol
sets flag to enable restore of failed storage replicas
restoreFailedStorage
in interface ClientProtocol
AccessControlException
- if the superuser privilege is violated.IOException
public void refreshNodes() throws IOException
ClientProtocol
refreshNodes
in interface ClientProtocol
IOException
public void finalizeUpgrade() throws IOException
ClientProtocol
finalizeUpgrade
in interface ClientProtocol
IOException
public CorruptFileBlocks listCorruptFileBlocks(String path, String cookie) throws IOException
listCorruptFileBlocks
in interface ClientProtocol
IOException
- Each call returns a subset of the corrupt files in the system. To obtain
all corrupt files, call this method repeatedly and each time pass in the
cookie returned from the previous call.public void metaSave(String filename) throws IOException
ClientProtocol
metaSave
in interface ClientProtocol
IOException
public HdfsFileStatus getFileInfo(String src) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException
ClientProtocol
getFileInfo
in interface ClientProtocol
src
- The string representation of the path to the fileAccessControlException
- permission deniedFileNotFoundException
- file src
is not foundUnresolvedLinkException
- if the path contains a symlink.IOException
- If an I/O error occurredpublic HdfsFileStatus getFileLinkInfo(String src) throws AccessControlException, UnresolvedLinkException, IOException
ClientProtocol
getFileLinkInfo
in interface ClientProtocol
src
- The string representation of the path to the fileAccessControlException
- permission deniedUnresolvedLinkException
- if src
contains a symlinkIOException
- If an I/O error occurredpublic ContentSummary getContentSummary(String path) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException
ClientProtocol
ContentSummary
rooted at the specified directory.getContentSummary
in interface ClientProtocol
path
- The string representation of the pathAccessControlException
- permission deniedFileNotFoundException
- file path
is not foundUnresolvedLinkException
- if path
contains a symlink.IOException
- If an I/O error occurredpublic void setQuota(String path, long namespaceQuota, long diskspaceQuota) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException
ClientProtocol
setQuota
in interface ClientProtocol
path
- The string representation of the path to the directorynamespaceQuota
- Limit on the number of names in the tree rooted
at the directorydiskspaceQuota
- Limit on disk space occupied all the files under
this directory.
HdfsConstants.QUOTA_DONT_SET
implies
the quota will not be changed, and (3) HdfsConstants.QUOTA_RESET
implies the quota will be reset. Any other value is a runtime error.AccessControlException
- permission deniedSnapshotAccessControlException
- if path is in RO snapshotFileNotFoundException
- file path
is not foundUnresolvedLinkException
- if the path
contains a symlink.QuotaExceededException
- if the directory size
is greater than the given quotaIOException
- If an I/O error occurredpublic void fsync(String src, String client, long lastBlockLength) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException
ClientProtocol
fsync
in interface ClientProtocol
src
- The string representation of the pathclient
- The string representation of the clientlastBlockLength
- The length of the last block (under construction)
to be reported to NameNodeAccessControlException
- permission deniedFileNotFoundException
- file src
is not foundUnresolvedLinkException
- if src
contains a symlink.IOException
- If an I/O error occurredpublic void setTimes(String src, long mtime, long atime) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException
ClientProtocol
setTimes
in interface ClientProtocol
src
- The string representation of the pathmtime
- The number of milliseconds since Jan 1, 1970.
Setting mtime to -1 means that modification time should not be set
by this call.atime
- The number of milliseconds since Jan 1, 1970.
Setting atime to -1 means that access time should not be set
by this call.AccessControlException
- permission deniedSnapshotAccessControlException
- if path is in RO snapshotFileNotFoundException
- file src
is not foundUnresolvedLinkException
- if src
contains a symlink.IOException
- If an I/O error occurredpublic void createSymlink(String target, String link, FsPermission dirPerm, boolean createParent) throws AccessControlException, FileAlreadyExistsException, FileNotFoundException, ParentNotDirectoryException, SafeModeException, UnresolvedLinkException, IOException
ClientProtocol
createSymlink
in interface ClientProtocol
target
- The path of the destination that the
link points to.link
- The path of the link being created.dirPerm
- permissions to use when creating parent directoriescreateParent
- - if true then missing parent dirs are created
if false then parent must existAccessControlException
- permission deniedSnapshotAccessControlException
- if path is in RO snapshotFileAlreadyExistsException
- If file link
already existsFileNotFoundException
- If parent of link
does not exist
and createParent
is falseParentNotDirectoryException
- If parent of link
is not a
directory.UnresolvedLinkException
- if link contains a symlink.
IOException
- If an I/O error occurredSafeModeException
public String getLinkTarget(String path) throws AccessControlException, FileNotFoundException, IOException
ClientProtocol
getLinkTarget
in interface ClientProtocol
path
- The path with a link that needs resolution.AccessControlException
- permission deniedFileNotFoundException
- If path
does not existIOException
- If the given path does not refer to a symlink
or an I/O error occurredpublic LocatedBlock updateBlockForPipeline(ExtendedBlock block, String clientName) throws IOException
ClientProtocol
updateBlockForPipeline
in interface ClientProtocol
block
- a blockclientName
- the name of the clientIOException
- if any error occurspublic void updatePipeline(String clientName, ExtendedBlock oldBlock, ExtendedBlock newBlock, DatanodeID[] newNodes) throws IOException
ClientProtocol
updatePipeline
in interface ClientProtocol
clientName
- the name of the clientoldBlock
- the old blocknewBlock
- the new block containing new generation stamp and lengthnewNodes
- datanodes in the pipelineIOException
- if any error occurspublic Token<DelegationTokenIdentifier> getDelegationToken(Text renewer) throws IOException
ClientProtocol
getDelegationToken
in interface ClientProtocol
renewer
- the designated renewer for the tokenIOException
public long renewDelegationToken(Token<DelegationTokenIdentifier> token) throws IOException
ClientProtocol
renewDelegationToken
in interface ClientProtocol
token
- delegation token obtained earlierIOException
public void cancelDelegationToken(Token<DelegationTokenIdentifier> token) throws IOException
ClientProtocol
cancelDelegationToken
in interface ClientProtocol
token
- delegation tokenIOException
public void setBalancerBandwidth(long bandwidth) throws IOException
ClientProtocol
setBalancerBandwidth
in interface ClientProtocol
bandwidth
- Blanacer bandwidth in bytes per second for this datanode.IOException
public boolean isMethodSupported(String methodName) throws IOException
ProtocolMetaInterface
isMethodSupported
in interface ProtocolMetaInterface
methodName
- The name of the methodIOException
public DataEncryptionKey getDataEncryptionKey() throws IOException
getDataEncryptionKey
in interface ClientProtocol
IOException
public boolean isFileClosed(String src) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException
ClientProtocol
isFileClosed
in interface ClientProtocol
src
- The string representation of the path to the fileAccessControlException
- permission deniedFileNotFoundException
- file src
is not foundUnresolvedLinkException
- if the path contains a symlink.IOException
- If an I/O error occurredpublic Object getUnderlyingProxyObject()
ProtocolTranslator
getUnderlyingProxyObject
in interface ProtocolTranslator
public String createSnapshot(String snapshotRoot, String snapshotName) throws IOException
ClientProtocol
createSnapshot
in interface ClientProtocol
snapshotRoot
- the path that is being snapshottedsnapshotName
- name of the snapshot createdIOException
public void deleteSnapshot(String snapshotRoot, String snapshotName) throws IOException
ClientProtocol
deleteSnapshot
in interface ClientProtocol
snapshotRoot
- The snapshottable directorysnapshotName
- Name of the snapshot for the snapshottable directoryIOException
public void allowSnapshot(String snapshotRoot) throws IOException
ClientProtocol
allowSnapshot
in interface ClientProtocol
snapshotRoot
- the directory to be snappedIOException
- on errorpublic void disallowSnapshot(String snapshotRoot) throws IOException
ClientProtocol
disallowSnapshot
in interface ClientProtocol
snapshotRoot
- the directory to disallow snapshotIOException
- on errorpublic void renameSnapshot(String snapshotRoot, String snapshotOldName, String snapshotNewName) throws IOException
ClientProtocol
renameSnapshot
in interface ClientProtocol
snapshotRoot
- the directory path where the snapshot was takensnapshotOldName
- old name of the snapshotsnapshotNewName
- new name of the snapshotIOException
public SnapshottableDirectoryStatus[] getSnapshottableDirListing() throws IOException
ClientProtocol
getSnapshottableDirListing
in interface ClientProtocol
IOException
- If an I/O error occurredpublic SnapshotDiffReport getSnapshotDiffReport(String snapshotRoot, String fromSnapshot, String toSnapshot) throws IOException
ClientProtocol
getSnapshotDiffReport
in interface ClientProtocol
snapshotRoot
- full path of the directory where snapshots are takenfromSnapshot
- snapshot name of the from point. Null indicates the current
treetoSnapshot
- snapshot name of the to point. Null indicates the current
tree.SnapshotDiffReport
.IOException
- on errorCopyright © 2013 Apache Software Foundation. All rights reserved.