Ferret File System/v0.1/process

From Woozle Writes Code
< Ferret File System‎ | v0.1
Revision as of 01:54, 4 December 2017 by Woozle (talk | contribs) (careful review produced more revision)
Jump to navigation Jump to search

When given a volume to scan, there are two sides to the scanning process:

  1. scanning the entry records to see if anything is missing
  2. scanning the volume to see what's on it (including any new entries)

Scanning the Entry Records

  • For every existing entry record for that volume:
    • Clear the "didFind" flag (FALSE). (These get set as entries are found during the filesystem scan.)
    • Set the "didSeek" flag TRUE. (Indicates entries that existed before this scan.)
    • Read the directory at the volume's URL.
    • For each matching filesystem item found
      • mark didFind = TRUE

We can update volume entries here, but then we still have to create new ones during the volume scan. It probably doesn't matter whether we do the update here and the insert there, or do both there.

Scanning the Volume

Each Filesystem Entry

For every filesystem entry in the current folder:

  • Look for a matching entry.
  • Does entry exist?
    • NO: create it
    • YES: Is entry a folder?
      • YES: Does folder have a folder entry?
        • YES: Is that entry marked noscan=TRUE?
          • YES: remember not to scan inside it.
  • Log that the entry was found, and whether it was new or existing.
  • If it was an existing entry, log any changes in the specs (timestamps, size).
  • If Entry is a File, do "Each File" below.
  • If Entry is a Folder, do "Each Folder" below, unless flagged as "noscan".

Each File

  • Check the firev to see if it matches.
  • Does it match?
    • YES: update the firev record "LastFound" timestamp.
    • NO: create a new firev and update the file's ID_Firev.
  • Log whether the firev has changed or not.

Each Folder

  • Is folder new?
  • YES:
    • Check name against text blacklist. Was it found?
      • YES:
        • Mark it "noScan" when creating.
        • Add a note which includes the matching blacklist line.
  • Is "noScan" set?
    • YES: log that it was not scanned ("noScan" is currently the only possible reason for this).
    • NO: do "Each Filesystem Entry" above for each entry in the folder's directory.