Ferret File System/v0.1/SQL/firev: Difference between revisions

From Woozle Writes Code
Jump to navigation Jump to search
m (Woozle moved page FileFerret/SQL/versions to FileFerret/SQL/firevs without leaving a redirect: less ambiguous term)
(basing new table on fideals; doc reorg & expansion)
Line 1: Line 1:
===fideals===
==About==
"[[/fideal|Fideal]]" is short for "ideal file". A fideal is the abstract idealization of the particular set of bytes contained within a file which is a perfect representation of the original – i.e. it either ''is'' the original, or it is a perfect copy. ("Original file" might be as good a name, but in some cases the "original" may become corrupted and one of the copies may be more accurate; the "fideal" is how the file is ''supposed'' to be.) Fideal records are generally only created when multiple copies of the same file are found, though they may also be created manually in order to track more information about a file.
"[[../terms/firev|Firev]]" is short for "file revision". A firev is a particular series of byte values that represents a particular revision, or version, of a [[../terms/fideal]]. Fideal records are generally only created when multiple copies of the same file are found, though they may also be created manually in order to track more information about a file.
 
A firev can be created either deliberately (as a result of user editing) or accidentally (imperfect transcription, drive corruption, viral infection).
===Fields===
* '''isDelib''': TRUE if this is known to be a deliberate user edit of the parent firev (must be FALSE if isAccid is TRUE)
* '''isAccid''': TRUE if this is known to be an accidental corruption of the parent firev (must be FALSE if isDelib is TRUE)
* '''Descr''' should describe, if known, what distinguishes this firev from other firevs of the same fideal (or from the parent firev, if there is one).
* '''FileHash''' is a unique fingerprint (hash) of the file, using an algorithm unlikely to produce duplicate hashes for even the smallest variation. See [http://us3.php.net/manual/en/function.hash.php hash()] for details; apparently these can be as long as 128 hexadecimal digits = 64 bytes.
===Rules===
* '''isDelib''' and '''isAccid''' can both be FALSE if the cause of the firev is not known (i.e. we know there's a knew firev, but not whether it was deliberate or accidental), but they cannot both be TRUE.
===History===
* '''2012-12-25''' Adapted/created from fideals
==SQL==
<mysql>CREATE TABLE `fideals` (
<mysql>CREATE TABLE `fideals` (
   `ID`        INT NOT NULL AUTO_INCREMENT,
   `ID`        INT NOT     NULL AUTO_INCREMENT,
   `Title`     VARCHAR(255) COMMENT "unique name for the file, wherever it may be found",
   `ID_Fideal` INT  DEFAULT NULL  COMMENT "ID of ideal file",
   `Descr`     VARCHAR(255) COMMENT "description, or pointer to wiki page",
  `ID_Parent` INT  DEFAULT NULL  COMMENT "ID of parent firev, if any",
   `AutoTitle` VARCHAR(255) COMMENT "automatically-generated title",
   `isDelib`   BOOL DEFAULT FALSE COMMENT "TRUE = this is known to be a deliberate user edit of the parent",
   `AutoDescr` VARCHAR(255) COMMENT "automatically-generated description",
   `isAccid`   BOOL DEFAULT FALSE COMMENT "TRUE = this is known to be an accidental corruption of the parent",
   `FileSize`  INT         COMMENT "correct file size in bytes",
   `Descr`     VARCHAR(255)       COMMENT "description of differences",
   `FileCkSum` INT          COMMENT "correct file checksum",
   `FileSize`  INT               COMMENT "correct file size in bytes",
   `FileHash` VARBINARY(64)      COMMENT "unique hash",
   PRIMARY KEY(`ID`)
   PRIMARY KEY(`ID`)
)
)
ENGINE = MYISAM;</mysql>
ENGINE = MYISAM;</mysql>
* Basically, if you want to describe a file, you don't; you describe the fideal. Files are localized instances (possibly imperfect copies) of fideals.
* '''Title''' will probably end up being some form of the filename, possibly with disambiguating text prepended.
* At some point I'll probably have some kind of syntax whereby the '''Descr''' field can refer to a wiki page for more info. Maybe just straight HTML?
* '''AutoDescr''' can be generated by the application which first goes looking for the fideal and which therefore may have more understanding of the fideal's purpose in life
* It's not clear whether we need something more elaborate than just a 4-byte checksum, because there are so many different ways of generating this.

Revision as of 18:43, 25 December 2012

About

"Firev" is short for "file revision". A firev is a particular series of byte values that represents a particular revision, or version, of a Ferret File System/v0.1/SQL/terms/fideal. Fideal records are generally only created when multiple copies of the same file are found, though they may also be created manually in order to track more information about a file.

A firev can be created either deliberately (as a result of user editing) or accidentally (imperfect transcription, drive corruption, viral infection).

Fields

  • isDelib: TRUE if this is known to be a deliberate user edit of the parent firev (must be FALSE if isAccid is TRUE)
  • isAccid: TRUE if this is known to be an accidental corruption of the parent firev (must be FALSE if isDelib is TRUE)
  • Descr should describe, if known, what distinguishes this firev from other firevs of the same fideal (or from the parent firev, if there is one).
  • FileHash is a unique fingerprint (hash) of the file, using an algorithm unlikely to produce duplicate hashes for even the smallest variation. See hash() for details; apparently these can be as long as 128 hexadecimal digits = 64 bytes.

Rules

  • isDelib and isAccid can both be FALSE if the cause of the firev is not known (i.e. we know there's a knew firev, but not whether it was deliberate or accidental), but they cannot both be TRUE.

History

  • 2012-12-25 Adapted/created from fideals

SQL

<mysql>CREATE TABLE `fideals` (

 `ID`        INT  NOT     NULL AUTO_INCREMENT,
 `ID_Fideal` INT  DEFAULT NULL  COMMENT "ID of ideal file",
 `ID_Parent` INT  DEFAULT NULL  COMMENT "ID of parent firev, if any",
 `isDelib`   BOOL DEFAULT FALSE COMMENT "TRUE = this is known to be a deliberate user edit of the parent",
 `isAccid`   BOOL DEFAULT FALSE COMMENT "TRUE = this is known to be an accidental corruption of the parent",
 `Descr`     VARCHAR(255)       COMMENT "description of differences",
 `FileSize`  INT                COMMENT "correct file size in bytes",
 `FileHash`  VARBINARY(64)      COMMENT "unique hash",
 PRIMARY KEY(`ID`)

) ENGINE = MYISAM;</mysql>