File Agent


http://yuml.me/edit/5c22f975

Event Translation

The file system does not raise a Move event when moving a file/folder from one directory to another. It raises a Delete event for the old file location and a Create event for the new file location. If the item being moved is a folder, only a single event sequence is generated for the folder itself.

The File Agent, through the FileSystemWatcherAdapter class, translates the Delete+Create sequenct to a Move event. It also raises events for a folder's children when a folder is affected.

Batching

The File Agent batches events and waits for an idle period before propagating events to the next agent in the pipeline (WorkflowAgent). The idle period is set at 10 seconds, defined in the application's settings (not the user's settings).

By batching events we avoid processing large files while they are still being copied.

The FileEventIdleBatch class simplifies the events before propagating them to ensure there are no contradictory events, eg. a Create followed by multiple Changes results in a single change, a create,delete results in no event,

Event Simplification Rules

Hashing

The Merkle Hash of each modified file is calculated after the idle wait, to ensure that the file is no longer being modified. The hash is stored in the local file state database.

Selective Synchronization

The File Agent participates in selective synchronization.

The agent filters all events against the list of Selected folders. When selective synchronization is enabled, Directory events bypass filtering.