org.apache.ignite.internal.processors.igfs

## Class IgfsFileAffinityRange

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

All Implemented Interfaces:
  Externalizable, Serializable, Message

    public class IgfsFileAffinityRange
    extends Object
    implements Message, Externalizable

Affinity range.

See Also:
  Serialized Form

### Field Summary

Fields
`static int` `RANGE_STATUS_INITIAL` Initial range status, right after creation.
`static int` `RANGE_STATUS_MOVED` Fragmentizer finished block copy for this range.
`static int` `RANGE_STATUS_MOVING` Moving range state.

### Constructor Summary

Constructors
Constructor and Description
`IgfsFileAffinityRange()` Empty constructor required by `Externalizable`.

### Method Summary

Methods
`IgniteUuid` `affinityKey()`
`boolean` `belongs(long blockStartOff)`
`IgfsFileAffinityRange` `concat(IgfsFileAffinityRange range)` Tries to concatenate this range with a given one.
`byte` `directType()` Gets message type.
`boolean` `empty()`
`long` `endOffset()`
`void` `expand(long blockStartOff, int expansionSize)` Expands this range by given block.
`byte` `fieldsCount()` Gets fields count.
`boolean` `greater(long blockStartOff)`
`boolean` `less(long blockStartOff)`
`void` `readExternal(ObjectInput in)`
`boolean` `readFrom(ByteBuffer buf, MessageReader reader)` Reads this message from provided byte buffer.
`boolean` `regionEqual(IgfsFileAffinityRange other)` Checks if range regions are equal.
`Collection<IgfsFileAffinityRange>` `split(long maxSize)` Splits range into collection if smaller ranges with length equal to `maxSize`.
`long` `startOffset()`
`int` `status()`
`String` `toString()`
`void` `writeExternal(ObjectOutput out)`
`boolean` `writeTo(ByteBuffer buf, MessageWriter writer)` Writes this message to provided byte buffer.

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

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

### Field Detail

#### RANGE_STATUS_INITIAL

    public static final int RANGE_STATUS_INITIAL

Initial range status, right after creation.

See Also:
  Constant Field Values

#### RANGE_STATUS_MOVING

    public static final int RANGE_STATUS_MOVING

Moving range state. Fragmentizer started blocks copy.

See Also:
  Constant Field Values

#### RANGE_STATUS_MOVED

    public static final int RANGE_STATUS_MOVED

Fragmentizer finished block copy for this range.

See Also:
  Constant Field Values

### Constructor Detail

#### IgfsFileAffinityRange

    public IgfsFileAffinityRange()

Empty constructor required by `Externalizable`.

### Method Detail

#### affinityKey

    public IgniteUuid affinityKey()

Returns:
  Affinity key for this range.

#### startOffset

    public long startOffset()

Returns:
  Range start offset.

#### endOffset

    public long endOffset()

Returns:
  Range end offset.

#### belongs

    public boolean belongs(long blockStartOff)

Parameters:
  `blockStartOff` - Block start offset to check.
Returns:
  `True` if block with given start offset belongs to this range.

#### less

    public boolean less(long blockStartOff)

Parameters:
  `blockStartOff` - Block start offset to check.
Returns:
  `True` if block with given start offset is located before this range.

#### greater

    public boolean greater(long blockStartOff)

Parameters:
  `blockStartOff` - Block start offset to check.
Returns:
  `True` if block with given start offset is located after this range.

#### empty

    public boolean empty()

Returns:
  If range is empty, i.e. has zero length.

#### status

    public int status()

Returns:
  Range status.

#### expand

    public void expand(long blockStartOff,
              int expansionSize)

Expands this range by given block.

Parameters:
  `blockStartOff` - Offset of block start.
  `expansionSize` - Block size.

#### split

    public Collection<IgfsFileAffinityRange> split(long maxSize)

Splits range into collection if smaller ranges with length equal to `maxSize`.

Parameters:
  `maxSize` - Split part maximum size.
Returns:
  Collection of range parts.

#### concat

    @Nullable
    public IgfsFileAffinityRange concat(IgfsFileAffinityRange range)

Tries to concatenate this range with a given one. If ranges are not adjacent, will return `null`.

Parameters:
  `range` - Range to concatenate with.
Returns:
  Concatenation result or `null` if ranges are not adjacent.

#### regionEqual

    public boolean regionEqual(IgfsFileAffinityRange other)

Checks if range regions are equal.

Parameters:
  `other` - Other range to check against.
Returns:
  `True` if range regions are equal.

#### 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`

#### writeTo

    public boolean writeTo(ByteBuffer buf,
                  MessageWriter writer)

Writes this message to provided byte buffer.

Specified by:
  `writeTo` in interface `Message`
Parameters:
  `buf` - Byte buffer.
  `writer` - Writer.
Returns:
  Whether message was fully written.

#### readFrom

    public boolean readFrom(ByteBuffer buf,
                   MessageReader reader)

Reads this message from provided byte buffer.

Specified by:
  `readFrom` in interface `Message`
Parameters:
  `buf` - Byte buffer.
  `reader` - Reader.
Returns:
  Whether message was fully read.

#### directType

    public byte directType()

Gets message type.

Specified by:
  `directType` in interface `Message`
Returns:
  Message type.

#### fieldsCount

    public byte fieldsCount()

Gets fields count.

Specified by:
  `fieldsCount` in interface `Message`
Returns:
  Fields count.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

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