Class ConsistentUnderFileSystem

  • All Implemented Interfaces:
    AsyncUfsClient, UnderFileSystem, java.io.Closeable, java.lang.AutoCloseable

    public abstract class ConsistentUnderFileSystem
    extends BaseUnderFileSystem
    Represents a consistent under filesystem which does not have eventual consistency issues.
    • Method Detail

      • createNonexistingFile

        public java.io.OutputStream createNonexistingFile​(java.lang.String path)
                                                   throws java.io.IOException
        Description copied from interface: UnderFileSystem
        Creates a file in the under file system with the indicated name. Similar to UnderFileSystem.create(String) but deals with the delete-then-create eventual consistency issue.
        Parameters:
        path - the file name
        Returns:
        A OutputStream object
        Throws:
        java.io.IOException
      • createNonexistingFile

        public java.io.OutputStream createNonexistingFile​(java.lang.String path,
                                                          CreateOptions options)
                                                   throws java.io.IOException
        Description copied from interface: UnderFileSystem
        Creates a file in the under file system with the specified CreateOptions. Similar to UnderFileSystem.create(String, CreateOptions) but deals with the delete-then-create eventual consistency issue.
        Parameters:
        path - the file name
        options - the options for create
        Returns:
        A OutputStream object
        Throws:
        java.io.IOException
      • deleteExistingDirectory

        public boolean deleteExistingDirectory​(java.lang.String path)
                                        throws java.io.IOException
        Description copied from interface: UnderFileSystem
        Deletes a directory from the under file system. Similar to UnderFileSystem.deleteDirectory(String) but deals with the create-delete eventual consistency issue.
        Parameters:
        path - of the directory to delete
        Returns:
        true if directory was found and deleted, false otherwise
        Throws:
        java.io.IOException
      • deleteExistingDirectory

        public boolean deleteExistingDirectory​(java.lang.String path,
                                               DeleteOptions options)
                                        throws java.io.IOException
        Description copied from interface: UnderFileSystem
        Deletes a directory from the under file system with the indicated name. Similar to UnderFileSystem.deleteDirectory(String, DeleteOptions) but deals with the create-then-delete eventual consistency issue.
        Parameters:
        path - of the directory to delete
        options - for directory delete semantics
        Returns:
        true if directory was found and deleted, false otherwise
        Throws:
        java.io.IOException
      • deleteExistingFile

        public boolean deleteExistingFile​(java.lang.String path)
                                   throws java.io.IOException
        Description copied from interface: UnderFileSystem
        Deletes a file from the under file system with the indicated name. Similar to UnderFileSystem.deleteFile(String) but deals with the create-then-delete eventual consistency issue.
        Parameters:
        path - of the file to delete
        Returns:
        true if file was found and deleted, false otherwise
        Throws:
        java.io.IOException
      • getExistingDirectoryStatus

        public UfsDirectoryStatus getExistingDirectoryStatus​(java.lang.String path)
                                                      throws java.io.IOException
        Description copied from interface: UnderFileSystem
        Gets the directory status. Similar to UnderFileSystem.getDirectoryStatus(String) but deals with the write-then-get-status eventual consistency issue.
        Parameters:
        path - the path to the directory
        Returns:
        the directory status
        Throws:
        java.io.IOException
      • getExistingFileStatus

        public UfsFileStatus getExistingFileStatus​(java.lang.String path)
                                            throws java.io.IOException
        Description copied from interface: UnderFileSystem
        Gets the file status. Similar to UnderFileSystem.getFileStatus(String) but deals with the write-then-get-status eventual consistency issue.
        Parameters:
        path - the path to the file
        Returns:
        the file status
        Throws:
        java.io.IOException
      • getExistingStatus

        public UfsStatus getExistingStatus​(java.lang.String path)
                                    throws java.io.IOException
        Description copied from interface: UnderFileSystem
        Gets the file or directory status. Similar to UnderFileSystem.getStatus(String) but deals with the write-then-get-status eventual consistency issue.
        Parameters:
        path - the path to get the status
        Returns:
        the file or directory status
        Throws:
        java.io.IOException
      • isExistingDirectory

        public boolean isExistingDirectory​(java.lang.String path)
                                    throws java.io.IOException
        Description copied from interface: UnderFileSystem
        Checks if a directory exists in under file system. Similar to UnderFileSystem.isDirectory(String) but deals with the write-then-list eventual consistency issue.
        Parameters:
        path - the absolute directory path
        Returns:
        true if the path exists and is a directory, false otherwise
        Throws:
        java.io.IOException
      • openExistingFile

        public java.io.InputStream openExistingFile​(java.lang.String path)
                                             throws java.io.IOException
        Description copied from interface: UnderFileSystem
        Opens an InputStream for a file in under filesystem at the indicated path. Similar to UnderFileSystem.open(String) but deals with the write-then-read eventual consistency issue.
        Parameters:
        path - the file name
        Returns:
        The InputStream object
        Throws:
        java.io.IOException
      • openExistingFile

        public java.io.InputStream openExistingFile​(java.lang.String path,
                                                    OpenOptions options)
                                             throws java.io.IOException
        Description copied from interface: UnderFileSystem
        Opens an InputStream for a file in under filesystem at the indicated path. Similar to UnderFileSystem.open(String, OpenOptions) but deals with the write-then-read eventual consistency issue.
        Parameters:
        path - the file name
        options - to open input stream
        Returns:
        The InputStream object
        Throws:
        java.io.IOException
      • renameRenamableDirectory

        public boolean renameRenamableDirectory​(java.lang.String src,
                                                java.lang.String dst)
                                         throws java.io.IOException
        Description copied from interface: UnderFileSystem
        Renames a directory from src to dst in under file system. Similar to UnderFileSystem.renameDirectory(String, String) but deals with the write-src-then-rename and delete-dst-then-rename eventual consistency issue.
        Parameters:
        src - the source directory path
        dst - the destination directory path
        Returns:
        true if succeed, false otherwise
        Throws:
        java.io.IOException
      • renameRenamableFile

        public boolean renameRenamableFile​(java.lang.String src,
                                           java.lang.String dst)
                                    throws java.io.IOException
        Description copied from interface: UnderFileSystem
        Renames a file from src to dst in under file system. Similar to UnderFileSystem.renameFile(String, String) but deals with the write-src-then-rename and delete-dst-then-rename eventual consistency issue.
        Parameters:
        src - the source file path
        dst - the destination file path
        Returns:
        true if succeed, false otherwise
        Throws:
        java.io.IOException