org.apache.ignite.internal.processors.igfs

## Class IgfsFileMap

- java.lang.Object
- - org.apache.ignite.internal.processors.igfs.IgfsFileMap

All Implemented Interfaces:
  Externalizable, Serializable, Binarylizable

    public class IgfsFileMap
    extends Object
    implements Externalizable, Binarylizable

Auxiliary class that is responsible for managing file affinity keys allocation by ranges.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`IgfsFileMap()` Empty constructor.
`IgfsFileMap(IgfsFileMap old)` Constructs same file map as passed in.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addRange(IgfsFileAffinityRange range)` Adds range to the list of already existing ranges.
`IgniteUuid` `affinityKey(long blockOff, boolean includeMoved)` Gets affinity key from file map based on block start offset.
`void` `deleteRange(IgfsFileAffinityRange range)` Deletes range from map.
`List<IgfsFileAffinityRange>` `ranges()` Gets full list of ranges present in this map.
`void` `readBinary(BinaryReader reader)` Reads fields from provided reader.
`void` `readExternal(ObjectInput in)`
`String` `toString()`
`void` `updateRangeStatus(IgfsFileAffinityRange range, int status)` Updates range status in file map.
`void` `writeBinary(BinaryWriter writer)` Writes fields to provided writer.
`void` `writeExternal(ObjectOutput out)`

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

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

### Constructor Detail

#### IgfsFileMap

    public IgfsFileMap()

Empty constructor.

#### IgfsFileMap

    public IgfsFileMap(@Nullable
                       IgfsFileMap old)

Constructs same file map as passed in.

Parameters:
  `old` - Old map.

### Method Detail

#### affinityKey

    public IgniteUuid affinityKey(long blockOff,
                                  boolean includeMoved)

Gets affinity key from file map based on block start offset.

Parameters:
  `blockOff` - Block start offset (divisible by block size).
  `includeMoved` - If `true` then will return affinity key for ranges marked as moved. Otherwise will return null for such ranges.
Returns:
  Affinity key.

#### updateRangeStatus

    public void updateRangeStatus(IgfsFileAffinityRange range,
                                  int status)

Updates range status in file map. Will split range into two ranges if given range is a sub-range starting from the same offset.

Parameters:
  `range` - Range to update status.
  `status` - New range status.

#### deleteRange

    public void deleteRange(IgfsFileAffinityRange range)

Deletes range from map.

Parameters:
  `range` - Range to delete.

#### ranges

    public List<IgfsFileAffinityRange> ranges()

Gets full list of ranges present in this map.

Returns:
  Unmodifiable list of ranges.

#### addRange

    public void addRange(IgfsFileAffinityRange range)

Adds range to the list of already existing ranges. Added range must be located after the last range in this map. If added range is adjacent to the last range in the map, added range will be concatenated to the last one.

Parameters:
  `range` - Range to add.

#### writeExternal

    public void writeExternal(ObjectOutput out)
                       throws IOException

Specified by:
  `writeExternal` in interface `Externalizable`
Throws:
  `IOException`

#### readExternal

    public void readExternal(ObjectInput in)
                      throws IOException,
                             ClassNotFoundException

Specified by:
  `readExternal` in interface `Externalizable`
Throws:
  `IOException`
  `ClassNotFoundException`

#### writeBinary

    public void writeBinary(BinaryWriter writer)
                     throws BinaryObjectException

Writes fields to provided writer.

Specified by:
  `writeBinary` in interface `Binarylizable`
Parameters:
  `writer` - Binary object writer.
Throws:
  `BinaryObjectException` - In case of error.

#### readBinary

    public void readBinary(BinaryReader reader)
                    throws BinaryObjectException

Reads fields from provided reader.

Specified by:
  `readBinary` in interface `Binarylizable`
Parameters:
  `reader` - Binary object reader.
Throws:
  `BinaryObjectException` - In case of error.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.4.0
Release Date | : March 5 2018