org.apache.ignite.igfs.secondary

## Interface IgfsSecondaryFileSystem

All Known Implementing Classes:
  LocalIgfsSecondaryFileSystem

    public interface IgfsSecondaryFileSystem

Secondary file system interface.

### Method Summary

All Methods Instance Methods Abstract Methods
`Collection<IgfsBlockLocation>` `affinity(IgfsPath path, long start, long len, long maxLen)` Get affinity block locations for data blocks of the file.
`OutputStream` `append(IgfsPath path, int bufSize, boolean create, Map<String,String> props)` Opens an output stream to an existing file for appending data.
`OutputStream` `create(IgfsPath path, boolean overwrite)` Creates a file and opens it for writing.
`OutputStream` `create(IgfsPath path, int bufSize, boolean overwrite, int replication, long blockSize, Map<String,String> props)` Creates a file and opens it for writing.
`boolean` `delete(IgfsPath path, boolean recursive)` Deletes file.
`boolean` `exists(IgfsPath path)` Checks if the specified path exists.
`IgfsFile` `info(IgfsPath path)` Gets file information for the specified path.
`Collection<IgfsFile>` `listFiles(IgfsPath path)` Lists files under the specified path.
`Collection<IgfsPath>` `listPaths(IgfsPath path)` Lists file paths under the specified path.
`void` `mkdirs(IgfsPath path)` Creates directories under specified path.
`void` `mkdirs(IgfsPath path, Map<String,String> props)` Creates directories under specified path with the specified properties.
`IgfsSecondaryFileSystemPositionedReadable` `open(IgfsPath path, int bufSize)` Opens a file for reading.
`void` `rename(IgfsPath src, IgfsPath dest)` Renames/moves a file.
`void` `setTimes(IgfsPath path, long modificationTime, long accessTime)` Set times for the given path.
`IgfsFile` `update(IgfsPath path, Map<String,String> props)` Updates file information for the specified path.
`long` `usedSpaceSize()` Gets used space in bytes.

### Method Detail

#### exists

    boolean exists(IgfsPath path)

Checks if the specified path exists.

Parameters:
  `path` - Path to check for existence.
Returns:
  `True` if such file exists, otherwise - `false`.
Throws:
  `IgniteException` - In case of error.

#### update

    IgfsFile update(IgfsPath path,
                    Map<String,String> props)
             throws IgniteException

Updates file information for the specified path. Existent properties, not listed in the passed collection, will not be affected. Other properties will be added or overwritten. Passed properties with `null` values will be removed from the stored properties or ignored if they don't exist in the file info.

When working in `DUAL_SYNC` or `DUAL_ASYNC` modes with Hadoop secondary file system only the following properties will be updated on the secondary file system:

- `usrName` - file owner name;
- `grpName` - file owner group;
- `permission` - Unix-style string representing file permissions.

Parameters:
  `path` - File path to set properties for.
  `props` - Properties to update.
Returns:
  File information for specified path or `null` if such path does not exist.
Throws:
  `IgniteException` - In case of error.

#### rename

    void rename(IgfsPath src,
                IgfsPath dest)
         throws IgniteException

Renames/moves a file.

You are free to rename/move data files as you wish, but directories can be only renamed. You cannot move the directory between different parent directories.

Examples:

- "/work/file.txt" => "/home/project/Presentation Scenario.txt"
- "/work" => "/work-2012.bkp"
- "/work" => "/backups/work" - such operation is restricted for directories.

Parameters:
  `src` - Source file path to rename.
  `dest` - Destination file path. If destination path is a directory, then source file will be placed into destination directory with original name.
Throws:
  `IgniteException` - In case of error.
  `IgfsPathNotFoundException` - If source file doesn't exist.

#### delete

    boolean delete(IgfsPath path,
                   boolean recursive)
            throws IgniteException

Deletes file.

Parameters:
  `path` - File path to delete.
  `recursive` - Delete non-empty directories recursively.
Returns:
  `True` in case of success, `false` otherwise.
Throws:
  `IgniteException` - In case of error.

#### mkdirs

    void mkdirs(IgfsPath path)
         throws IgniteException

Creates directories under specified path.

Parameters:
  `path` - Path of directories chain to create.
Throws:
  `IgniteException` - In case of error.

#### mkdirs

    void mkdirs(IgfsPath path,
                @Nullable
                Map<String,String> props)
         throws IgniteException

Creates directories under specified path with the specified properties.

Parameters:
  `path` - Path of directories chain to create.
  `props` - Metadata properties to set on created directories.
Throws:
  `IgniteException` - In case of error.

#### listPaths

    Collection<IgfsPath> listPaths(IgfsPath path)
                            throws IgniteException

Lists file paths under the specified path.

Parameters:
  `path` - Path to list files under.
Returns:
  List of paths under the specified path.
Throws:
  `IgniteException` - In case of error.
  `IgfsPathNotFoundException` - If path doesn't exist.

#### listFiles

    Collection<IgfsFile> listFiles(IgfsPath path)
                            throws IgniteException

Lists files under the specified path.

Parameters:
  `path` - Path to list files under.
Returns:
  List of files under the specified path.
Throws:
  `IgniteException` - In case of error.
  `IgfsPathNotFoundException` - If path doesn't exist.

#### open

    IgfsSecondaryFileSystemPositionedReadable open(IgfsPath path,
                                                   int bufSize)
                                            throws IgniteException

Opens a file for reading.

Parameters:
  `path` - File path to read.
  `bufSize` - Read buffer size (bytes) or `zero` to use default value.
Returns:
  File input stream to read data from.
Throws:
  `IgniteException` - In case of error.
  `IgfsPathNotFoundException` - If path doesn't exist.

#### create

    OutputStream create(IgfsPath path,
                        boolean overwrite)
                 throws IgniteException

Creates a file and opens it for writing.

Parameters:
  `path` - File path to create.
  `overwrite` - Overwrite file if it already exists. Note: you cannot overwrite an existent directory.
Returns:
  File output stream to write data to.
Throws:
  `IgniteException` - In case of error.

#### create

    OutputStream create(IgfsPath path,
                        int bufSize,
                        boolean overwrite,
                        int replication,
                        long blockSize,
                        @Nullable
                        Map<String,String> props)
                 throws IgniteException

Creates a file and opens it for writing.

Parameters:
  `path` - File path to create.
  `bufSize` - Write buffer size (bytes) or `zero` to use default value.
  `overwrite` - Overwrite file if it already exists. Note: you cannot overwrite an existent directory.
  `replication` - Replication factor.
  `blockSize` - Block size.
  `props` - File properties to set.
Returns:
  File output stream to write data to.
Throws:
  `IgniteException` - In case of error.

#### append

    OutputStream append(IgfsPath path,
                        int bufSize,
                        boolean create,
                        @Nullable
                        Map<String,String> props)
                 throws IgniteException

Opens an output stream to an existing file for appending data.

Parameters:
  `path` - File path to append.
  `bufSize` - Write buffer size (bytes) or `zero` to use default value.
  `create` - Create file if it doesn't exist yet.
  `props` - File properties to set only in case it file was just created.
Returns:
  File output stream to append data to.
Throws:
  `IgniteException` - In case of error.
  `IgfsPathNotFoundException` - If path doesn't exist and create flag is `false`.

#### info

    IgfsFile info(IgfsPath path)
           throws IgniteException

Gets file information for the specified path.

Parameters:
  `path` - Path to get information for.
Returns:
  File information for specified path or `null` if such path does not exist.
Throws:
  `IgniteException` - In case of error.

#### usedSpaceSize

    long usedSpaceSize()
                throws IgniteException

Gets used space in bytes.

Returns:
  Used space in bytes.
Throws:
  `IgniteException` - In case of error.

#### setTimes

    void setTimes(IgfsPath path,
                  long modificationTime,
                  long accessTime)
           throws IgniteException

Set times for the given path.

Parameters:
  `path` - Path.
  `modificationTime` - Modification time.
  `accessTime` - Access time.
Throws:
  `IgniteException` - If failed.

#### affinity

    Collection<IgfsBlockLocation> affinity(IgfsPath path,
                                           long start,
                                           long len,
                                           long maxLen)
                                    throws IgniteException

Get affinity block locations for data blocks of the file. In case `maxLen` parameter is set and particular block location length is greater than this value, block locations will be split into smaller chunks.

Parameters:
  `path` - File path to get affinity for.
  `start` - Position in the file to start affinity resolution from.
  `len` - Size of data in the file to resolve affinity for.
  `maxLen` - Maximum length of a single returned block location length.
Returns:
  Affinity block locations.
Throws:
  `IgniteException` - In case of error.
  `IgfsPathNotFoundException` - If path doesn't exist.

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.7.0
Release Date | : November 30 2018