-
Notifications
You must be signed in to change notification settings - Fork 1
FileDirectoryQueue
FileDirectoryQueue is a Queue descendant which uses a single directory of the file system for storage means.
The directory is considered flat, no nested catalogs are ever used.
Each file found in the directory is to create a Job where the request.id parameter is set to the local file name. To limit the scope, test () method can be implemented in a subclass.
FileDirectoryQueue doesn't subscribes to any file system notifications, it's up do the subclasses developers to invoke check () in right moments. Files created and then deleted between to sequential check () invocations, will stay unnoticed.
The sequence of requests is determined by fs.Dir. Normally, file names come in alphabetical order.
It's presumed that each job launched from this queue must remove the original file somewhere out of the directory. Otherwise, copied requests will come in an infinite loop. Again, it's the application developer's responsibility to implement adequate error handling (at least, to set a reasonable Lag).
| Name | Type | Description |
|---|---|---|
dirname |
String | The underlying directory's absolute path |
This synchronous method is called by peek () for each dirent.name supplied by fs.Dir.
If test (name) returns true (wich is the default) or any other truthy value, {...this.request, id: name} request is invoked.
Otherwise (including cases where errors are thrown from test (name)), the file is skipped and the scanning goes on.