org.apache.ignite.events

## Class IgfsEvent

- java.lang.Object
- - org.apache.ignite.events.EventAdapter
  - - org.apache.ignite.events.IgfsEvent

All Implemented Interfaces:
  Serializable, Comparable<Event>, Event

    public class IgfsEvent
    extends EventAdapter

IGFS event.

Grid events are used for notification about what happens within the grid. Note that by design Ignite keeps all events generated on the local node locally and it provides APIs for performing a distributed queries across multiple nodes:

- `IgniteEvents.remoteQuery(org.apache.ignite.lang.IgnitePredicate, long, int...)` - asynchronously querying events occurred on the nodes specified, including remote nodes.
- `IgniteEvents.localQuery(org.apache.ignite.lang.IgnitePredicate, int...)` - querying only local events stored on this local node.
- `IgniteEvents.localListen(org.apache.ignite.lang.IgnitePredicate, int...)` - listening to local grid events (events from remote nodes not included).

User can also wait for events using method `IgniteEvents.waitForLocal(org.apache.ignite.lang.IgnitePredicate, int...)`.

# Events and Performance

Note that by default all events in Ignite are enabled and therefore generated and stored by whatever event storage SPI is configured. Ignite can and often does generate thousands events per seconds under the load and therefore it creates a significant additional load on the system. If these events are not needed by the application this load is unnecessary and leads to significant performance degradation.

It is highly recommended to enable only those events that your application logic requires by using `IgniteConfiguration.getIncludeEventTypes()` method in Ignite configuration. Note that certain events are required for Ignite's internal operations and such events will still be generated but not stored by event storage SPI if they are disabled in Ignite configuration.

See Also:
  `EventType.EVT_IGFS_FILE_CREATED`, `EventType.EVT_IGFS_FILE_RENAMED`, `EventType.EVT_IGFS_FILE_DELETED`, Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`IgfsEvent(IgfsPath path, ClusterNode node, int type)` Constructs an event instance.
`IgfsEvent(IgfsPath path, ClusterNode node, int type, long dataSize)` Constructs an event instance for close events: (`EventType.EVT_IGFS_FILE_CLOSED_READ`, `EventType.EVT_IGFS_FILE_CLOSED_WRITE`).
`IgfsEvent(IgfsPath path, ClusterNode node, int type, Map<String,String> meta)` Constructs an event instance for file metadata update events (`EventType.EVT_IGFS_META_UPDATED`).
`IgfsEvent(IgfsPath path, IgfsPath newPath, ClusterNode node, int type)` Constructs an event instance for path modification event (`EventType.EVT_IGFS_FILE_RENAMED`, `EventType.EVT_IGFS_DIR_RENAMED`).

### Method Summary

Methods
`long` `dataSize()` Transferred data size for this event.
`boolean` `isDirectory()` Checks if this is a directory-related event.
`IgfsPath` `newPath()` New file or directory path for this event (used in `EventType.EVT_IGFS_FILE_RENAMED` event).
`IgfsPath` `path()` Path of the file or directory, on which event has occurred.
`String` `toString()`
`Map<String,String>` `updatedMeta()` Updated file metadata properties.

### Methods inherited from class org.apache.ignite.events.EventAdapter

`compareTo, equals, hashCode, id, localOrder, message, message, name, node, node, shortDisplay, timestamp, type, type`

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

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

### Constructor Detail

#### IgfsEvent

    public IgfsEvent(IgfsPath path,
             ClusterNode node,
             int type)

Constructs an event instance.

Parameters:
  `path` - File or directory path.
  `node` - Node.
  `type` - Event type.

#### IgfsEvent

    public IgfsEvent(IgfsPath path,
             IgfsPath newPath,
             ClusterNode node,
             int type)

Constructs an event instance for path modification event (`EventType.EVT_IGFS_FILE_RENAMED`, `EventType.EVT_IGFS_DIR_RENAMED`).

Parameters:
  `path` - File or directory path.
  `newPath` - New file or directory path.
  `node` - Node.
  `type` - Event type.

#### IgfsEvent

    public IgfsEvent(IgfsPath path,
             ClusterNode node,
             int type,
             long dataSize)

Constructs an event instance for close events: (`EventType.EVT_IGFS_FILE_CLOSED_READ`, `EventType.EVT_IGFS_FILE_CLOSED_WRITE`).

Parameters:
  `path` - File path.
  `node` - Node.
  `type` - Event type.
  `dataSize` - Transferred data size in bytes.

#### IgfsEvent

    public IgfsEvent(IgfsPath path,
             ClusterNode node,
             int type,
             Map<String,String> meta)

Constructs an event instance for file metadata update events (`EventType.EVT_IGFS_META_UPDATED`).

Parameters:
  `path` - File path.
  `node` - Node.
  `type` - Event type.
  `meta` - Modified properties.

### Method Detail

#### path

    public IgfsPath path()

Path of the file or directory, on which event has occurred.

Returns:
  File path.

#### newPath

    @Nullable
    public IgfsPath newPath()

New file or directory path for this event (used in `EventType.EVT_IGFS_FILE_RENAMED` event).

Returns:
  New file or directory path or `null`, if not relevant for this event.

#### dataSize

    public long dataSize()

Transferred data size for this event.

Returns:
  Transferred data size in bytes.

#### updatedMeta

    @Nullable
    public Map<String,String> updatedMeta()

Updated file metadata properties.

Returns:
  Updated metadata properties or `null`, if not relevant for this event.

#### isDirectory

    public boolean isDirectory()

Checks if this is a directory-related event.

Returns:
  `True` if this event is directory-related.

#### toString

    public String toString()

Overrides:
  `toString` in class `EventAdapter`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.5.0-b1
Release Date | : December 1 2015