
 =  AlexisDoc > Programming > Client Server > CHAKRIYA FILE STORAGE MECHANISM


VERSION

   Version 0.1 (alpha) Date: 15/4/2003 Nick Reddel

BRIEF DESCRIPTION

   Note: naming conventions.

   file  is  understood,  for  the rest of this documentation section, to mean "a variable-depth object reference
   recognised by two systems "

   The  filesystem  will  be a stored as a set of tables in a relational SQL database, with data validation rules
   described  in  a  set  of  XML  schema,  and  table  >  hierarchical infoset mapping described in a set of XML
   documents.

MINIMAL IMPLEMENTATION

     Tables: (bootstrapping requires file_info and system_docs)

     * file_info: stores properties shared by all file types, and each file's inode number
     * file_journal: stores information regarding changes to files
     * file_links: stores references between files
     * file_links_lookup: lookup for above
     * system_xml_documents: XML instance documents and schema which describe the system to itself
     _________________________________________________________________________________________________________


     file_info: stores properties shared by all file types, and each file's inode number

     Columns:

  -->>
  
     +-------------------------+--------------+------+-----+---------------------+----------------+
     | Field                   | Type         | Null | Key | Default             | Extra          |
     +-------------------------+--------------+------+-----+---------------------+----------------+
     | id                      | int(11)      |      | PRI | NULL                | auto_increment |(inode
     number)
     | date_modified_attr      | datetime     |      |     | 0000-00-00 00:00:00 |                |
     | date_created            | datetime     |      |     | 0000-00-00 00:00:00 |                |
     | permissions             | mediumtext   |      |     |                     |                |
     | created_by              | int(11)      |      |     | 0                   |                |
     | modified_by             | int(11)      |      |     | 0                   |                |
     | owner                   | int(11)      |      |     | 0                   |                |
     | lock_owner              | int(11)      |      |     | 0                   |                |
     | primary_table           | varchar(100) |      |     |                     |                |
     | primary_table_id        | int(11)      |      |     | 0                   |                |
     | date_modified_content   | datetime     |      |     | 0000-00-00 00:00:00 |                |
     | deleted                 | tinyint(1)   |      |     | 0                   |                |
     | non_standard_attributes | mediumtext   |      |     |                     |                |
     | usage_key_1                 | varchar(100) |      |     |                     |                |(internal
     sub-classification, type-dependent)
     | usage_key_2             | varchar(100) |      |     |                     |                |(internal
     sub-classification, type-dependent)
     +-------------------------+--------------+------+-----+---------------------+----------------+
     file_journal: stores information regarding changes to files

     Columns:

     +--------------------+--------------+------+-----+---------------------+----------------+
     | Field              | Type         | Null | Key | Default             | Extra          |
     +--------------------+--------------+------+-----+---------------------+----------------+
     | id                 | bigint(20)   |      | PRI | NULL                | auto_increment |
     | fsi_id             | bigint(20)   |      |     | 0                   |                |
     | action             | varchar(100) |      |     |                     |                |
     | user               | int(11)      |      |     | 0                   |                |
     | dt_stamp           | datetime     |      |     | 0000-00-00 00:00:00 |                |
     | prior_file_infoset | longtext     |      |     |                     |                |//store     values
     prior to action (or enough to undo with diff)
     +--------------------+--------------+------+-----+---------------------+----------------+
  --<<
  
     file_links_lookup: stores references between files

     notes:
     * links are regarded as one-way. true bidirectional links will be handled separately, if ever
     * the  links  field will be semi-colon separated Strings, each an inode number (for human readability, since
       the lookup table handles any work). 

  -->>
     +------------------+--------------+------+-----+---------+-------+
     | Field            | Type         | Null | Key | Default | Extra |
     +------------------+--------------+------+-----+---------+-------+
     | id               | bigint(20)   |      | PRI | 0       |       |
     | owner_fsi_id     | bigint(20)   |      |     | 0       |       |
     | links            | tinytext     |      |     |         |       |
     | target_file_type | varchar(100) |      |     |         |       |
     +------------------+--------------+------+-----+---------+-------+
  --<<
  
     file_links_lookup: lookup to references between files

     notes:
     * primary  table  id  fields  are  deprecated/discouraged, because all references should be made using inode
       numbers for consistency. They're kept because they're faster, in case optimised queries are needed at some
       stage.


     Columns:
     
  -->>
     +-------------------------+--------------+------+-----+---------+----------------+
     | Field                   | Type         | Null | Key | Default | Extra          |
     +-------------------------+--------------+------+-----+---------+----------------+
     | id                      | bigint(20)   |      | PRI | NULL    | auto_increment |
     | from_inode              | bigint(20)   |      |     | 0       |                |
     | from_primary_table_id   | bigint(20)   |      |     | 0       |                |
     | from_primary_table_name | varchar(100) |      |     |         |                |
     | to_inode                | bigint(20)   |      |     | 0       |                |
     | to_primary_table_id     | bigint(20)   |      |     | 0       |                |
     | to_primary_table_name   | bigint(20)   |      |     | 0       |                |
     +-------------------------+--------------+------+-----+---------+----------------+
  --<<
  
     system_documents: XML instance documents and schema which describe the system

     Columns:
     
  -->>
     +----------------+--------------+------+-----+---------+----------------+
     | Field          | Type         | Null | Key | Default | Extra          |
     +----------------+--------------+------+-----+---------+----------------+
     | id             | int(11)      |      | PRI | NULL    | auto_increment |
     | caption        | varchar(255) |      |     |         |                |
     | content        | mediumtext   | YES  |     | NULL    |                |
     | file_info_id   | bigint(11)   | YES  |     | 0       |                |
     | schema_link_id | bigint(20)   |      |     | 0       |                |
     | dtd_link_id    | bigint(20)   |      |     | 0       |                |
     | css_link_id    | bigint(20)   |      |     | 0       |                |
     | cssx_link_id   | bigint(20)   |      |     | 0       |                |
     | is_schema      | tinyint(1)   |      |     | 0       |                |
     +----------------+--------------+------+-----+---------+----------------+
  --<<


 ACTUAL IMPLEMENTATION

     Tables: (as well as those above)

     * public_tree:  user-editable  hierarchy  of  symbolic  links  to  elsewhere  in  the  hierarchy  - a shared
       "favourites" folder structure
     * shared_xml_documents:  XML  instance documents and schema which define many aspects of the client (Macros,
       templates, GUI preferences)
       note:  the client will also have access to system_xml_documents, so as to be able to share validation info
       et. al.
     * system_support_documents: non-XML documents (DTDs etc) describing the system
     * shared_support_documents: non-XML documents (DTDs, Stylesheets, ) describing the client

     public_tree:  user-editable  hierarchy  of  symbolic  links  to  elsewhere  in  the  hierarchy  -  a shared
     "favourites" folder structure

  -->>
     +---------------------+--------------+------+-----+---------+-------+
     | Field               | Type         | Null | Key | Default | Extra |
     +---------------------+--------------+------+-----+---------+-------+
     | id                  | bigint(20)   |      |     | 0       |       |
     | file_info_id        | bigint(20)   |      |     | 0       |       |
     | target_file_info_id | bigint(20)   |      |     | 0       |       |
     | target_path         | varchar(255) |      |     |         |       | (used in preference to inode)
     | parent_id           | bigint(20)   |      |     | 0       |       |
     | caption             | varchar(255) |      |     |         |       |
     +---------------------+--------------+------+-----+---------+-------+
  --<<

     shared_xml_documents:  XML  instance  documents and schema which define many aspects of the client (Macros,
     templates, GUI preferences)
     note:  the  client will also have access to system_xml_documents, so as to be able to share validation info
     et. al.

     definition: same as for system_xml_documents

     system_support_documents: non-XML documents (DTDs etc) describing the system

  -->>
     +--------------+--------------+------+-----+---------+----------------+
     | Field        | Type         | Null | Key | Default | Extra          |
     +--------------+--------------+------+-----+---------+----------------+
     | id           | int(11)      |      | PRI | NULL    | auto_increment |
     | caption      | varchar(255) |      |     |         |                |
     | content      | mediumtext   | YES  |     | NULL    |                |
     | file_info_id | bigint(11)   | YES  |     | 0       |                |
     | file_type    | varchar(100) |      |     |         |                |
     +--------------+--------------+------+-----+---------+----------------+
  --<<
     shared_support_documents: non-XML documents (DTDs, Stylesheets, ) describing the client

     as for system_support_documents
     _________________________________________________________________________________________________________

   Planned tables for Alexis internal documentation server deployment:
     * image_files
     * sound_files
     * messages
     * discussion_threads
     * xml_documents
     * support_documents


 SUGGESTED IMPROVEMENTS

   The  obvious  one  seems  to  be  to  avoid  duplication, the number of tables could be reduced and keys used.
   However,  there  are  three tiers: resources which the server needs, resources which the client app needs, and
   resources  which  the  users  of  the client app need. Since there's only duplication of 2 tables each, let it
   stand for the moment. Note the 2 keys left in file_info to allow for this later.


   LAST UPDATE:
   Nick Reddel
   Tuesday April 15, 2003
   
