/ Check-in [8bf5154b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Remove, for now, the "priority" column from the zonefile_files virtual table.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | zonefile
Files: files | file ages | folders
SHA3-256: 8bf5154bc6e31e206931d97c743eadaba4ef938c11e006082d795439dadaeb8f
User & Date: dan 2018-02-13 18:02:00
Context
2018-02-13
19:01
Enhance ext/zonefile/README.md to describe the currently available functionality. check-in: 100137c7 user: dan tags: zonefile
18:02
Remove, for now, the "priority" column from the zonefile_files virtual table. check-in: 8bf5154b user: dan tags: zonefile
17:33
Pad the 26 byte Zonefile header to 32 bytes so that the ZonefileIndex object is 8-byte aligned. check-in: fdb6c0c5 user: dan tags: zonefile
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/zonefile/README.md.

     1      1   
     2      2   Notes:
     3      3   
     4         -  *  Using 32-bit frame numbers (not 16-bit).
            4  +  *  Contrary to the spec, the implementation uses 32-bit (not 16-bit) frame
            5  +     numbers. So the KeyOffsetPair structure becomes:
            6  +
            7  +     KeyOffsetPair
            8  +     {
            9  +       uint64  key;
           10  +       uint32  frameNo;
           11  +       uint32  frameByteOffset;
           12  +     };
           13  +
           14  +     Also, the ZonefileHeader.numFrames field is now 32-bit. Which makes
           15  +     the ZonefileHeader structure 26 bytes in size. The implementation
           16  +     pads this out to 32 bytes so that the ZoneFileIndex is 8-byte aligned.
     5     17   
     6         -  *  The ZonefileHeader object is 26 bytes in size. Which means that the
     7         -     ZoneFileIndex will not be 8-byte aligned. Problem?
           18  +  *  Multi-byte integer values are big-endian.
     8     19   
     9     20     *  The offsets in the ZoneFileIndex.byteOffsetZoneFrame[] array are
    10     21        relative to the offset in ZoneFileHeader.byteOffsetFrames. This is
    11     22        necessary as we may not know the offset of the start of the frame data
    12     23        until after the ZoneFileIndex structure is compressed.
           24  +
           25  +  *  Currently there is no support for encryption or compression.
    13     26   
    14     27   

Changes to ext/zonefile/zonefile.c.

    54     54     "  ofst INTEGER,"              \
    55     55     "  sz INTEGER"                 \
    56     56     ")"
    57     57   
    58     58   #define ZONEFILE_FILES_SCHEMA    \
    59     59     "CREATE TABLE z2("             \
    60     60     "  filename TEXT,"             \
    61         -  "  priority INTEGER,"          \
    62     61     "  ekey BLOB,"                 \
    63     62     "  header JSON HIDDEN"         \
    64     63     ")"
    65     64   
    66     65   
    67     66   #include <stdio.h>
    68     67   #include <string.h>
................................................................................
   741    740   */
   742    741   static int zffColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){
   743    742     ZonefileFilesCsr *pCsr = (ZonefileFilesCsr*)cur;
   744    743     switch( i ){
   745    744       case 0: /* filename */
   746    745         sqlite3_result_value(ctx, sqlite3_column_value(pCsr->pSelect, 0));
   747    746         break;
   748         -    case 1: /* priority */
          747  +    case 1: /* ekey */
   749    748         break;
   750         -    case 2: /* ekey */
   751         -      break;
   752         -    case 3: { /* header */
          749  +    case 2: { /* header */
   753    750         const char *zFile = (const char*)sqlite3_column_text(pCsr->pSelect, 0);
   754    751         zonefileJsonHeader(ctx, zFile);
   755    752         break;
   756    753       }
   757    754     }
   758    755     return SQLITE_OK;
   759    756   }
................................................................................
   868    865   **
   869    866   ** A delete specifies a single argument - the rowid of the row to remove.
   870    867   ** 
   871    868   ** Update and insert operations pass:
   872    869   **
   873    870   **   1. The "old" rowid, or NULL.
   874    871   **   2. The "new" rowid.
   875         -**   3. Values for each of the 4 columns: (filename,priority,ekey,header)
          872  +**   3. Values for each of the 3 columns: (filename,ekey,header)
   876    873   */
   877    874   static int zffUpdate(
   878    875     sqlite3_vtab *pVtab, 
   879    876     int nVal, 
   880    877     sqlite3_value **apVal, 
   881    878     sqlite_int64 *pRowid
   882    879   ){
................................................................................
   991    988             "  fileid INTEGER,"
   992    989             "  frame INTEGER,"
   993    990             "  ofst INTEGER,"
   994    991             "  sz INTEGER"
   995    992             ");"
   996    993             "CREATE TABLE %Q.'%q_shadow_file'(" 
   997    994             "  filename TEXT,"
   998         -          "  priority INTEGER,"
   999    995             "  fileid INTEGER PRIMARY KEY"
  1000    996             ");" 
  1001    997             "CREATE VIRTUAL TABLE %Q.'%q_files' USING zonefile_files;",
  1002    998             zDb, zName, zDb, zName, zDb, zName
  1003    999         );
  1004   1000     
  1005   1001         if( zSql==0 ){