Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FolderNest

A folder nest is a nest which contains a backing folder at a specific _path. If the folder does not exist, antfarm can optionally create it.

Hierarchy

Index

Constructors

constructor

Properties

Protected _id

_id: string

Protected _name

_name: string

Protected _tunnel

_tunnel: Tunnel

Private _watcher

_watcher: any

Protected allowCreate

allowCreate: boolean

Protected e

Protected heldJobs

heldJobs: FileJob | FolderJob

Protected path

path: string

Accessors

id

  • get id(): string

name

  • get name(): string
  • set name(name: string): void

tunnel

Private watcher

  • get watcher(): any

Methods

arrive

Protected checkDirectorySync

  • checkDirectorySync(directory: any): void
  • Check if the _path for the backing folder is created. If not, optionally create it.

    Parameters

    • directory: any

    Returns void

Protected createJob

  • createJob(path: string, arrive?: boolean): any
  • Function that creates and arrives new jobs. Can produce file or folder jobs.

    Parameters

    • path: string
    • Default value arrive: boolean = true

    Returns any

getHeldJob

  • getHeldJob(jobId: string): any
  • Get a held job with a job id. Removes it from the held job queue, so you should move it out of the folder after using this.

    Parameters

    • jobId: string

    Returns any

    Example

    var tunnel = af.createTunnel("Checkpoint example");
    var webhook = af.createWebhookNest(["test", "example"], "get");
    var holding_folder = af.createAutoFolderNest(["test", "checkpoint"]);
    
    var im = webhook.getInterfaceManager();
    
    // Watch for jobs, hold, and provide to the interface.
    im.checkNest(holding_folder);
    tunnel.watch(webhook);
    
    tunnel.run(function(job, nest){
         // Get the job_id from the webhook request
         var job_id = job.getParameter("job_id");
         // Get the held job from the holding folder
         var checkpoint_job = holding_folder.getHeldJob(job_id);
         // Move somewhere else
         checkpoint_job.move(af.createAutoFolderNest(["test", "outfolder"]));
    });
    

getHeldJobs

getUnwatchedJobs

  • getUnwatchedJobs(): Array<any>
  • Loads jobs that have piled up in the nest if it was not watched. No longer used.

    Returns Array<any>

    Array of jobs

Protected holdJob

Protected isUnixHiddenPath

  • isUnixHiddenPath(path: string): boolean
  • Checks whether a _path starts with or contains a hidden file or a folder.

    Parameters

    • path: string

      The _path of the file that needs to be validated. returns {boolean} - true if the source is blacklisted and otherwise false.

    Returns boolean

load

  • load(hold?: boolean): void
  • Initial load of the contents of the directory.

    Parameters

    • Default value hold: boolean = false

      Optional flag to hold jobs found.

    Returns void

register

  • register(tunnel: Tunnel): void

take

toString

  • toString(): string

watch

  • watch(hold?: boolean): void
  • Watches the folder.

    Parameters

    • Default value hold: boolean = false

      Optional flag to hold jobs found.

    Returns void

watchHold

  • watchHold(): void

Generated using TypeDoc