@Test public void checkAnnotations() { Method[] methods = NamenodeProtocols.class.getMethods(); for (Method m : methods) { Assert.assertTrue( "Idempotent or AtMostOnce annotation is not present " + m, m.isAnnotationPresent(Idempotent.class) || m.isAnnotationPresent(AtMostOnce.class)); } }
@AtMostOnce public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request) throws YarnException, IOException;
/** * Create an encryption zone */ @AtMostOnce public void createEncryptionZone(String src, String keyName) throws IOException;
@AtMostOnce NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request) throws YarnException, IOException;
/** * Create an encryption zone. */ @AtMostOnce void createEncryptionZone(String src, String keyName) throws IOException;
@AtMostOnce public MaterializeCryptoKeysResponse materializeCrypto (MaterializeCryptoKeysRequest request) throws YarnException, IOException;
@AtMostOnce public RemoveCryptoKeysResponse removeCrypto(RemoveCryptoKeysRequest request) throws YarnException, IOException;
/** * <p>The interface used by an <code>ApplicationMaster</code> to notify the * <code>ResourceManager</code> about its completion (success or failed).</p> * * <p>The <code>ApplicationMaster</code> has to provide details such as * final state, diagnostics (in case of failures) etc. as specified in * {@link FinishApplicationMasterRequest}.</p> * * <p>The <code>ResourceManager</code> responds with * {@link FinishApplicationMasterResponse}.</p> * * @param request completion request * @return completion response * @throws YarnException * @throws IOException * @see FinishApplicationMasterRequest * @see FinishApplicationMasterResponse */ @Public @Stable @AtMostOnce public FinishApplicationMasterResponse finishApplicationMaster( FinishApplicationMasterRequest request) throws YarnException, IOException;
/** * Create a new file entry in the namespace. * <p> * 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. * <p> * Once created, the file is visible and available for read to other clients. * Although, other clients cannot {@link #delete(String, boolean)}, re-create or * {@link #rename(String, String)} it until the file is completed * or explicitly as a result of lease expiration. * <p> * Blocks have a maximum size. Clients that intend to create * multi-block files must also use * {@link #addBlock} * * @param src path of the file being created. * @param masked masked permission. * @param clientName name of the current client. * @param flag indicates whether the file should be * overwritten if it already exists or create if it does not exist or append. * @param createParent create missing parent directory if true * @param replication block replication factor. * @param blockSize maximum block size. * @param supportedVersions CryptoProtocolVersions supported by the client * * @return the status of the created file, it could be null if the server * doesn't support returning the file status * @throws AccessControlException If access is denied * @throws AlreadyBeingCreatedException if the path does not exist. * @throws DSQuotaExceededException If file creation violates disk space * quota restriction * @throws FileAlreadyExistsException If file <code>src</code> already exists * @throws FileNotFoundException If parent of <code>src</code> does not exist * and <code>createParent</code> is false * @throws ParentNotDirectoryException If parent of <code>src</code> is not a * directory. * @throws NSQuotaExceededException If file creation violates name space * quota restriction * @throws SafeModeException create not allowed in safemode * @throws UnresolvedLinkException If <code>src</code> contains a symlink * @throws SnapshotAccessControlException if path is in RO snapshot * @throws IOException If an I/O error occurred * * RuntimeExceptions: * @throws InvalidPathException Path <code>src</code> is invalid * <p> * <em>Note that create with {@link CreateFlag#OVERWRITE} is idempotent.</em> */ @AtMostOnce public HdfsFileStatus create(String src, FsPermission masked, String clientName, EnumSetWritable<CreateFlag> flag, boolean createParent, short replication, long blockSize, CryptoProtocolVersion[] supportedVersions) throws AccessControlException, AlreadyBeingCreatedException, DSQuotaExceededException, FileAlreadyExistsException, FileNotFoundException, NSQuotaExceededException, ParentNotDirectoryException, SafeModeException, UnresolvedLinkException, SnapshotAccessControlException, IOException;
/** * Rename src to dst. * <ul> * <li>Fails if src is a file and dst is a directory. * <li>Fails if src is a directory and dst is a file. * <li>Fails if the parent of dst does not exist or is a file. * </ul> * <p> * 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. * <p> * This implementation of rename is atomic. * <p> * @param src existing file or directory name. * @param dst new name. * @param options Rename options * * @throws AccessControlException If access is denied * @throws DSQuotaExceededException If rename violates disk space * quota restriction * @throws FileAlreadyExistsException If <code>dst</code> already exists and * <code>options</options> has {@link Rename#OVERWRITE} option * false. * @throws FileNotFoundException If <code>src</code> does not exist * @throws NSQuotaExceededException If rename violates namespace * quota restriction * @throws ParentNotDirectoryException If parent of <code>dst</code> * is not a directory * @throws SafeModeException rename not allowed in safemode * @throws UnresolvedLinkException If <code>src</code> or * <code>dst</code> contains a symlink * @throws SnapshotAccessControlException if path is in RO snapshot * @throws IOException If an I/O error occurred */ @AtMostOnce public void rename2(String src, String dst, Options.Rename... options) throws AccessControlException, DSQuotaExceededException, FileAlreadyExistsException, FileNotFoundException, NSQuotaExceededException, ParentNotDirectoryException, SafeModeException, UnresolvedLinkException, SnapshotAccessControlException, IOException;
/** * Create symlink to a file or directory. * @param target The path of the destination that the * link points to. * @param link The path of the link being created. * @param dirPerm permissions to use when creating parent directories * @param createParent - if true then missing parent dirs are created * if false then parent must exist * * @throws AccessControlException permission denied * @throws FileAlreadyExistsException If file <code>link</code> already exists * @throws FileNotFoundException If parent of <code>link</code> does not exist * and <code>createParent</code> is false * @throws ParentNotDirectoryException If parent of <code>link</code> is not a * directory. * @throws UnresolvedLinkException if <code>link</target> contains a symlink. * @throws SnapshotAccessControlException if path is in RO snapshot * @throws IOException If an I/O error occurred */ @AtMostOnce public void createSymlink(String target, String link, FsPermission dirPerm, boolean createParent) throws AccessControlException, FileAlreadyExistsException, FileNotFoundException, ParentNotDirectoryException, SafeModeException, UnresolvedLinkException, SnapshotAccessControlException, IOException;
/** * Create a new file entry in the namespace. * <p> * 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. * <p> * Once created, the file is visible and available for read to other clients. * Although, other clients cannot {@link #delete(String, boolean)}, re-create * or {@link #rename(String, String)} it until the file is completed * or explicitly as a result of lease expiration. * <p> * Blocks have a maximum size. Clients that intend to create * multi-block files must also use * {@link #addBlock} * * @param src path of the file being created. * @param masked masked permission. * @param clientName name of the current client. * @param flag indicates whether the file should be * overwritten if it already exists or create if it does not exist or append. * @param createParent create missing parent directory if true * @param replication block replication factor. * @param blockSize maximum block size. * @param supportedVersions CryptoProtocolVersions supported by the client * * @return the status of the created file, it could be null if the server * doesn't support returning the file status * @throws org.apache.hadoop.security.AccessControlException If access is * denied * @throws AlreadyBeingCreatedException if the path does not exist. * @throws DSQuotaExceededException If file creation violates disk space * quota restriction * @throws org.apache.hadoop.fs.FileAlreadyExistsException If file * <code>src</code> already exists * @throws java.io.FileNotFoundException If parent of <code>src</code> does * not exist and <code>createParent</code> is false * @throws org.apache.hadoop.fs.ParentNotDirectoryException If parent of * <code>src</code> is not a directory. * @throws NSQuotaExceededException If file creation violates name space * quota restriction * @throws org.apache.hadoop.hdfs.server.namenode.SafeModeException create not * allowed in safemode * @throws org.apache.hadoop.fs.UnresolvedLinkException If <code>src</code> * contains a symlink * @throws SnapshotAccessControlException if path is in RO snapshot * @throws IOException If an I/O error occurred * * RuntimeExceptions: * @throws org.apache.hadoop.fs.InvalidPathException Path <code>src</code> is * invalid * <p> * <em>Note that create with {@link CreateFlag#OVERWRITE} is idempotent.</em> */ @AtMostOnce HdfsFileStatus create(String src, FsPermission masked, String clientName, EnumSetWritable<CreateFlag> flag, boolean createParent, short replication, long blockSize, CryptoProtocolVersion[] supportedVersions) throws IOException;
/** * Create a new file entry in the namespace. * <p> * 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. * <p> * Once created, the file is visible and available for read to other clients. * Although, other clients cannot {@link #delete(String, boolean)}, re-create or * {@link #rename(String, String)} it until the file is completed * or explicitly as a result of lease expiration. * <p> * Blocks have a maximum size. Clients that intend to create * multi-block files must also use * {@link #addBlock} * * @param src path of the file being created. * @param masked masked permission. * @param clientName name of the current client. * @param flag indicates whether the file should be * overwritten if it already exists or create if it does not exist or append. * @param createParent create missing parent directory if true * @param replication block replication factor. * @param blockSize maximum block size. * * @return the status of the created file, it could be null if the server * doesn't support returning the file status * @throws AccessControlException If access is denied * @throws AlreadyBeingCreatedException if the path does not exist. * @throws DSQuotaExceededException If file creation violates disk space * quota restriction * @throws FileAlreadyExistsException If file <code>src</code> already exists * @throws FileNotFoundException If parent of <code>src</code> does not exist * and <code>createParent</code> is false * @throws ParentNotDirectoryException If parent of <code>src</code> is not a * directory. * @throws NSQuotaExceededException If file creation violates name space * quota restriction * @throws SafeModeException create not allowed in safemode * @throws UnresolvedLinkException If <code>src</code> contains a symlink * @throws SnapshotAccessControlException if path is in RO snapshot * @throws IOException If an I/O error occurred * * RuntimeExceptions: * @throws InvalidPathException Path <code>src</code> is invalid * <p> * <em>Note that create with {@link CreateFlag#OVERWRITE} is idempotent.</em> */ @AtMostOnce 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, SnapshotAccessControlException, IOException;