org.apache.ignite.internal.processors.igfs

## Class IgfsMetaManager

- java.lang.Object
- - org.apache.ignite.internal.processors.igfs.IgfsManager
  - - org.apache.ignite.internal.processors.igfs.IgfsMetaManager

    public class IgfsMetaManager
    extends IgfsManager

Cache based structure (meta data) manager.

### Field Summary

### Fields inherited from class org.apache.ignite.internal.processors.igfs.IgfsManager

`igfsCtx`

### Constructor Summary

Constructors
Constructor and Description
`IgfsMetaManager()`

### Method Summary

Methods
`IgfsSecondaryOutputStreamDescriptor` `appendDual(IgfsSecondaryFileSystem fs, IgfsPath path, int bufSize)` Append to a file in DUAL mode.
`IgfsSecondaryOutputStreamDescriptor` `createDual(IgfsSecondaryFileSystem fs, IgfsPath path, boolean simpleCreate, Map<String,String> props, boolean overwrite, int bufSize, short replication, long blockSize, IgniteUuid affKey)` Create the file in DUAL mode.
`boolean` `deleteDual(IgfsSecondaryFileSystem fs, IgfsPath path, boolean recursive)` Delete path in DUAL mode.
`Map<String,IgfsListingEntry>` `directoryListing(IgniteUuid fileId)` List child files for specified file ID.
`boolean` `exists(IgniteUuid fileId)` Ensure that entry with the given ID exists in meta cache.
`IgfsFileInfo` `fileForFragmentizer(Collection<IgniteUuid> exclude)` Gets first available file info for fragmentizer.
`IgniteUuid` `fileId(IgfsPath path)` Gets file ID for specified path.
`IgniteUuid` `fileId(IgniteUuid parentId, String fileName)` Gets file ID by its name from parent directory listing.
`List<IgniteUuid>` `fileIds(IgfsPath path)` Gets all file IDs for components of specified path.
`IgfsFileInfo` `info(IgniteUuid fileId)` Gets file info by its ID.
`Map<IgniteUuid,IgfsFileInfo>` `infos(Collection<IgniteUuid> fileIds)` Gets files details by their IDs.
`IgfsFileInfo` `lock(IgniteUuid fileId)` Lock the file explicitly outside of transaction.
`IgfsFileInfo` `lockInfo(IgfsFileInfo info)` Set lock on file info.
`boolean` `mkdirsDual(IgfsSecondaryFileSystem fs, IgfsPath path, Map<String,String> props)` Create directory in DUAL mode.
`void` `move(IgniteUuid fileId, String srcFileName, IgniteUuid srcParentId, String destFileName, IgniteUuid destParentId)` Move or rename file.
`protected void` `onKernalStart0()`
`protected void` `onKernalStop0(boolean cancel)`
`IgfsSecondaryInputStreamDescriptor` `openDual(IgfsSecondaryFileSystem fs, IgfsPath path, int bufSize)` Open file in DUAL mode.
`Collection<IgniteUuid>` `pendingDeletes()` Check whether there are any pending deletes and return collection of pending delete entry IDs.
`IgniteUuid` `putIfAbsent(IgniteUuid parentId, String fileName, IgfsFileInfo newFileInfo)` Add file into file system structure.
`IgfsFileInfo` `removeIfEmpty(IgniteUuid parentId, String fileName, IgniteUuid fileId, IgfsPath path, boolean rmvLocked)` Remove file from the file system structure.
`boolean` `renameDual(IgfsSecondaryFileSystem fs, IgfsPath src, IgfsPath dest)` Rename path in DUAL mode.
`Boolean` `sampling()` Get sampling flag state.
`boolean` `sampling(Boolean val)` Set sampling flag.
`protected void` `start0()` Start manager implementation.
`IgfsFileInfo` `synchronizeFileDual(IgfsSecondaryFileSystem fs, IgfsPath path)` Synchronizes with secondary file system.
`void` `unlock(IgfsFileInfo info, long modificationTime)` Remove explicit lock on file held by the current thread.
`IgfsFileInfo` `updateDual(IgfsSecondaryFileSystem fs, IgfsPath path, Map<String,String> props)` Update path in DUAL mode.
`IgfsFileInfo` `updateInfo(IgniteUuid fileId, IgniteClosure<IgfsFileInfo,IgfsFileInfo> c)` Update file info in cache.
`void` `updateParentListingAsync(IgniteUuid parentId, IgniteUuid fileId, String fileName, long lenDelta, long modificationTime)` Asynchronously updates record in parent listing.
`IgfsFileInfo` `updateProperties(IgniteUuid parentId, IgniteUuid fileId, String fileName, Map<String,String> props)` Update file info (file properties) in cache.
`void` `updateTimes(IgniteUuid parentId, IgniteUuid fileId, String fileName, long accessTime, long modificationTime)` Updates last access and last modification times.

### Methods inherited from class org.apache.ignite.internal.processors.igfs.IgfsManager

`kernalStartInfo, kernalStopInfo, onKernalStart, onKernalStop, start, startInfo, stop, stop0, stopInfo`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### IgfsMetaManager

    public IgfsMetaManager()

### Method Detail

#### start0

    protected void start0()
                   throws IgniteCheckedException

Start manager implementation.

Overrides:
  `start0` in class `IgfsManager`
Throws:
  `IgniteCheckedException`

#### onKernalStart0

    protected void onKernalStart0()
                           throws IgniteCheckedException

Overrides:
  `onKernalStart0` in class `IgfsManager`
Throws:
  `IgniteCheckedException` - If failed.

#### onKernalStop0

    protected void onKernalStop0(boolean cancel)

Overrides:
  `onKernalStop0` in class `IgfsManager`

#### fileId

    @Nullable
    public IgniteUuid fileId(IgfsPath path)
                      throws IgniteCheckedException

Gets file ID for specified path.

Parameters:
  `path` - Path.
Returns:
  File ID for specified path or `null` if such file doesn't exist.
Throws:
  `IgniteCheckedException` - If failed.

#### fileId

    @Nullable
    public IgniteUuid fileId(IgniteUuid parentId,
                             String fileName)
                      throws IgniteCheckedException

Gets file ID by its name from parent directory listing.

Parameters:
  `parentId` - Parent directory ID to get child ID for.
  `fileName` - File name in parent listing to get file ID for.
Returns:
  File ID.
Throws:
  `IgniteCheckedException` - If failed.

#### fileIds

    public List<IgniteUuid> fileIds(IgfsPath path)
                             throws IgniteCheckedException

Gets all file IDs for components of specified path. Result cannot be empty - there is at least root element. But each element (except the first) can be `null` if such files don't exist.

Parameters:
  `path` - Path.
Returns:
  Collection of file IDs for components of specified path.
Throws:
  `IgniteCheckedException` - If failed.

#### exists

    public boolean exists(IgniteUuid fileId)
                   throws IgniteCheckedException

Ensure that entry with the given ID exists in meta cache.

Parameters:
  `fileId` - File id.
Returns:
  `True` in case such entry exists.
Throws:
  `IgniteCheckedException` - IF failed.

#### info

    @Nullable
    public IgfsFileInfo info(@Nullable
                             IgniteUuid fileId)
                      throws IgniteCheckedException

Gets file info by its ID.

Parameters:
  `fileId` - File ID to get details for.
Returns:
  File info.
Throws:
  `IgniteCheckedException` - If failed.

#### infos

    public Map<IgniteUuid,IgfsFileInfo> infos(Collection<IgniteUuid> fileIds)
                                       throws IgniteCheckedException

Gets files details by their IDs.

Parameters:
  `fileIds` - file IDs to get details for.
Returns:
  Files details.
Throws:
  `IgniteCheckedException` - If failed.

#### lock

    public IgfsFileInfo lock(IgniteUuid fileId)
                      throws IgniteCheckedException

Lock the file explicitly outside of transaction.

Parameters:
  `fileId` - File ID to lock.
Returns:
  Locked file info or `null` if file cannot be locked or doesn't exist.
Throws:
  `IgniteCheckedException` - If failed.

#### lockInfo

    public IgfsFileInfo lockInfo(IgfsFileInfo info)
                          throws IgniteCheckedException

Set lock on file info.

Parameters:
  `info` - File info.
Returns:
  New file info with lock set.
Throws:
  `IgniteCheckedException` - In case lock is already set on that file.

#### unlock

    public void unlock(IgfsFileInfo info,
              long modificationTime)
                throws IgniteCheckedException

Remove explicit lock on file held by the current thread.

Parameters:
  `info` - File info to unlock.
  `modificationTime` - Modification time to write to file info.
Throws:
  `IgniteCheckedException` - If failed.

#### directoryListing

    public Map<String,IgfsListingEntry> directoryListing(IgniteUuid fileId)
                                                  throws IgniteCheckedException

List child files for specified file ID.

Parameters:
  `fileId` - File to list child files for.
Returns:
  Directory listing for the specified file.
Throws:
  `IgniteCheckedException` - If failed.

#### fileForFragmentizer

    public IgfsFileInfo fileForFragmentizer(Collection<IgniteUuid> exclude)
                                     throws IgniteCheckedException

Gets first available file info for fragmentizer.

Parameters:
  `exclude` - File IDs to exclude from result.
Returns:
  First qualified file info.
Throws:
  `IgniteCheckedException` - If failed to get file for fragmentizer.

#### putIfAbsent

    public IgniteUuid putIfAbsent(IgniteUuid parentId,
                         String fileName,
                         IgfsFileInfo newFileInfo)
                           throws IgniteCheckedException

Add file into file system structure.

Parameters:
  `parentId` - Parent file ID.
  `fileName` - File name in the parent's listing.
  `newFileInfo` - File info to store in the parent's listing.
Returns:
  File id already stored in meta cache or `null` if passed file info was stored.
Throws:
  `IgniteCheckedException` - If failed.

#### move

    public void move(IgniteUuid fileId,
            String srcFileName,
            IgniteUuid srcParentId,
            String destFileName,
            IgniteUuid destParentId)
              throws IgniteCheckedException

Move or rename file.

Parameters:
  `fileId` - File ID to move or rename.
  `srcFileName` - Original file name in the parent's listing.
  `srcParentId` - Parent directory ID.
  `destFileName` - New file name in the parent's listing after moving.
  `destParentId` - New parent directory ID.
Throws:
  `IgniteCheckedException` - If failed.

#### removeIfEmpty

    @Nullable
    public IgfsFileInfo removeIfEmpty(IgniteUuid parentId,
                                      String fileName,
                                      IgniteUuid fileId,
                                      IgfsPath path,
                                      boolean rmvLocked)
                               throws IgniteCheckedException

Remove file from the file system structure.

Parameters:
  `parentId` - Parent file ID.
  `fileName` - New file name in the parent's listing.
  `fileId` - File ID to remove.
  `path` - Path of the deleted file.
  `rmvLocked` - Whether to remove this entry in case it is has explicit lock.
Returns:
  The last actual file info or `null` if such file no more exist.
Throws:
  `IgniteCheckedException` - If failed.

#### pendingDeletes

    public Collection<IgniteUuid> pendingDeletes()
                                          throws IgniteCheckedException

Check whether there are any pending deletes and return collection of pending delete entry IDs.

Returns:
  Collection of entry IDs to be deleted.
Throws:
  `IgniteCheckedException` - If operation failed.

#### updateProperties

    @Nullable
    public IgfsFileInfo updateProperties(@Nullable
                                         IgniteUuid parentId,
                                         IgniteUuid fileId,
                                         String fileName,
                                         Map<String,String> props)
                                  throws IgniteCheckedException

Update file info (file properties) in cache.

Parameters:
  `parentId` - Parent ID (`null` if file is root).
  `fileName` - To update listing.
  `fileId` - File ID to update information for.
  `props` - Properties to set for the file.
Returns:
  Updated file info or `null` if such file ID not found.
Throws:
  `IgniteCheckedException` - If operation failed.

#### updateParentListingAsync

    public void updateParentListingAsync(IgniteUuid parentId,
                                IgniteUuid fileId,
                                String fileName,
                                long lenDelta,
                                long modificationTime)

Asynchronously updates record in parent listing.

Parameters:
  `parentId` - Parent ID.
  `fileId` - File ID.
  `fileName` - File name.
  `lenDelta` - Length delta.
  `modificationTime` - Last modification time.

#### updateInfo

    @Nullable
    public IgfsFileInfo updateInfo(IgniteUuid fileId,
                                   IgniteClosure<IgfsFileInfo,IgfsFileInfo> c)
                            throws IgniteCheckedException

Update file info in cache.

Parameters:
  `fileId` - File ID to update information for.
  `c` - Closure to update file's info inside transaction.
Returns:
  Updated file info or `null` if such file ID not found.
Throws:
  `IgniteCheckedException` - If failed.

#### sampling

    public boolean sampling(Boolean val)
                     throws IgniteCheckedException

Set sampling flag.

Parameters:
  `val` - Sampling flag state or `null` to clear sampling state and mark it as "not set".
Returns:
  `True` if sampling mode was actually changed by this call.
Throws:
  `IgniteCheckedException` - If failed.

#### sampling

    public Boolean sampling()
                     throws IgniteCheckedException

Get sampling flag state.

Returns:
  `True` in case sampling is enabled, `false` otherwise or `null` in case sampling is not set.
Throws:
  `IgniteCheckedException` - If failed.

#### createDual

    public IgfsSecondaryOutputStreamDescriptor createDual(IgfsSecondaryFileSystem fs,
                                                 IgfsPath path,
                                                 boolean simpleCreate,
                                                 @Nullable
                                                 Map<String,String> props,
                                                 boolean overwrite,
                                                 int bufSize,
                                                 short replication,
                                                 long blockSize,
                                                 IgniteUuid affKey)
                                                   throws IgniteCheckedException

Create the file in DUAL mode.

Parameters:
  `fs` - File system.
  `path` - Path.
  `simpleCreate` - "Simple create" flag.
  `props` - Properties..
  `overwrite` - Overwrite flag.
  `bufSize` - Buffer size.
  `replication` - Replication factor.
  `blockSize` - Block size.
  `affKey` - Affinity key.
Returns:
  Output stream descriptor.
Throws:
  `IgniteCheckedException` - If file creation failed.

#### appendDual

    public IgfsSecondaryOutputStreamDescriptor appendDual(IgfsSecondaryFileSystem fs,
                                                 IgfsPath path,
                                                 int bufSize)
                                                   throws IgniteCheckedException

Append to a file in DUAL mode.

Parameters:
  `fs` - File system.
  `path` - Path.
  `bufSize` - Buffer size.
Returns:
  Output stream descriptor.
Throws:
  `IgniteCheckedException` - If output stream open for append has failed.

#### openDual

    public IgfsSecondaryInputStreamDescriptor openDual(IgfsSecondaryFileSystem fs,
                                              IgfsPath path,
                                              int bufSize)
                                                throws IgniteCheckedException

Open file in DUAL mode.

Parameters:
  `fs` - Secondary file system.
  `path` - Path to open.
  `bufSize` - Buffer size.
Returns:
  Input stream descriptor.
Throws:
  `IgniteCheckedException` - If input stream open has failed.

#### synchronizeFileDual

    @Nullable
    public IgfsFileInfo synchronizeFileDual(IgfsSecondaryFileSystem fs,
                                            IgfsPath path)
                                     throws IgniteCheckedException

Synchronizes with secondary file system.

Parameters:
  `fs` - File system.
  `path` - Path.
Returns:
  File info or `null` if file not found.
Throws:
  `IgniteCheckedException` - If sync task failed.

#### mkdirsDual

    public boolean mkdirsDual(IgfsSecondaryFileSystem fs,
                     IgfsPath path,
                     Map<String,String> props)
                       throws IgniteCheckedException

Create directory in DUAL mode.

Parameters:
  `fs` - Secondary file system.
  `path` - Path to create.
  `props` - Properties to be applied.
Returns:
  `True` in case rename was successful.
Throws:
  `IgniteCheckedException` - If directory creation failed.

#### renameDual

    public boolean renameDual(IgfsSecondaryFileSystem fs,
                     IgfsPath src,
                     IgfsPath dest)
                       throws IgniteCheckedException

Rename path in DUAL mode.

Parameters:
  `fs` - Secondary file system.
  `src` - Source path.
  `dest` - Destination path.
Returns:
  Operation result.
Throws:
  `IgniteCheckedException` - If failed.

#### deleteDual

    public boolean deleteDual(IgfsSecondaryFileSystem fs,
                     IgfsPath path,
                     boolean recursive)
                       throws IgniteCheckedException

Delete path in DUAL mode.

Parameters:
  `fs` - Secondary file system.
  `path` - Path to update.
  `recursive` - Recursive flag.
Returns:
  Operation result.
Throws:
  `IgniteCheckedException` - If delete failed.

#### updateDual

    public IgfsFileInfo updateDual(IgfsSecondaryFileSystem fs,
                          IgfsPath path,
                          Map<String,String> props)
                            throws IgniteCheckedException

Update path in DUAL mode.

Parameters:
  `fs` - Secondary file system.
  `path` - Path to update.
  `props` - Properties to be applied.
Returns:
  Update file info.
Throws:
  `IgniteCheckedException` - If update failed.

#### updateTimes

    public void updateTimes(IgniteUuid parentId,
                   IgniteUuid fileId,
                   String fileName,
                   long accessTime,
                   long modificationTime)
                     throws IgniteCheckedException

Updates last access and last modification times.

Parameters:
  `parentId` - File parent ID.
  `fileId` - File ID to update.
  `fileName` - File name to update. Must match file ID.
  `accessTime` - Access time to set. If `-1`, will not be updated.
  `modificationTime` - Modification time to set. If `-1`, will not be updated.
Throws:
  `IgniteCheckedException` - If update failed.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.3.0-incubating
Release Date | : July 10 2015