Ferret File System/v0.1/process: Difference between revisions
< Ferret File System | v0.1
Jump to navigation
Jump to search
(imperative tense; more instructions) |
m (Woozle moved page FileFerret/process to Ferret File System/v0.1/process: obsolete) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
When given a {{l/fileferret/sql|volume}} to scan, there are two sides to the scanning process: | |||
When given a {{l/fileferret/sql|volume}} to scan, | # Are there new items? | ||
* For every {{l/fileferret/sql|entry}} record | # Has anything been deleted? | ||
** Clear the "didFind" flag. (These get set as entries are found during the scan.) | |||
** Set the "didSeek" flag. (Indicates entries that existed before this scan.) | Both questions can be answered by: | ||
* Read the directory at the volume's URL. | * marking every file in the current index as "not found" | ||
* For each item found, do | * scanning the volume to get a list of all files currently present | ||
===Each Entry=== | * updating the index for each file found to show that the file has been found | ||
Any files still marked "not found" have been removed from the volume since the last scan (which can be noted in a log of some kind). | |||
==Scanning the Entry Records== | |||
* For every existing {{l/fileferret/sql|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 {{l/fileferret/sql|entry}}. | * Look for a matching {{l/fileferret/sql|entry}}. | ||
* | * Does entry exist? | ||
** NO: create it | |||
** YES: Is entry a folder? | |||
*** YES: Does folder have a {{l/fileferret/sql|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. | * 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 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 File, do "Each File" below. | ||
* If Entry is a Folder, do "Each Folder" below. | * If Entry is a Folder, do "Each Folder" below, unless flagged as "noscan". | ||
===Each File=== | ===Each File=== | ||
* Check the {{l/fileferret/sql|firev}} to see if it matches. | * Check the {{l/fileferret/sql|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=== | ===Each Folder=== | ||
* | * Is folder new? | ||
** Check name against text blacklist. | * YES: | ||
** | ** Check name against text blacklist. Was it found? | ||
*** Mark it "noScan" when creating. | *** YES: | ||
*** Add a note which includes the matching blacklist line. | **** Mark it "noScan" when creating. | ||
* | **** Add a note which includes the matching blacklist line. | ||
** log that it was not scanned ("noScan" is currently the only possible reason for this) | * Is "noScan" set? | ||
** YES: log that it was not scanned ("noScan" is currently the only possible reason for this). | |||
** do "Each Entry" above for each entry in the folder's directory. | ** NO: do "Each Filesystem Entry" above for each entry in the folder's directory. |
Latest revision as of 13:40, 25 February 2024
When given a volume to scan, there are two sides to the scanning process:
- Are there new items?
- Has anything been deleted?
Both questions can be answered by:
- marking every file in the current index as "not found"
- scanning the volume to get a list of all files currently present
- updating the index for each file found to show that the file has been found
Any files still marked "not found" have been removed from the volume since the last scan (which can be noted in a log of some kind).
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.
- YES: Is that entry marked noscan=TRUE?
- YES: Does folder have a folder entry?
- 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.
- YES:
- Check name against text blacklist. Was it found?
- 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.