SQLite

Check-in [7bb633639d]
Login

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

Overview
Comment:Add comments to explain the role of the ota vfs.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | ota-update-no-pager_ota_mode
Files: files | file ages | folders
SHA1: 7bb633639d1e41067903a49653f09a823054e213
User & Date: dan 2015-02-07 20:20:32.171
Context
2015-02-09
20:07
Add the sqlite3ota_create_vfs() and sqlite3ota_destroy_vfs() functions. (check-in: 96443ecb69 user: dan tags: ota-update-no-pager_ota_mode)
2015-02-07
20:20
Add comments to explain the role of the ota vfs. (check-in: 7bb633639d user: dan tags: ota-update-no-pager_ota_mode)
19:17
Remove "PRAGMA pager_ota_mode". (check-in: 8ac58e4678 user: dan tags: ota-update-no-pager_ota_mode)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/ota/sqlite3ota.c.
2149
2150
2151
2152
2153
2154
2155





2156





2157
2158
2159
2160
2161
2162



2163











2164
2165
2166
2167
2168
2169
2170
2171
  return pOta->nProgress;
}

/**************************************************************************
** Beginning of OTA VFS shim methods. The VFS shim modifies the behaviour
** of a standard VFS in the following ways:
**





**   TODO





*/

#if 0
#define OTA_FILE_VANILLA    0
#define OTA_FILE_TARGET_DB  1
#define OTA_FILE_TARGET_WAL 2



#endif












typedef struct ota_file ota_file;
typedef struct ota_vfs ota_vfs;

struct ota_file {
  sqlite3_file base;              /* sqlite3_file methods */
  sqlite3_file *pReal;            /* Underlying file handle */
  ota_vfs *pOtaVfs;               /* Pointer to the ota_vfs object */







>
>
>
>
>
|
>
>
>
>
>
|
|
<
|
<
<
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>








2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168

2169


2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
  return pOta->nProgress;
}

/**************************************************************************
** Beginning of OTA VFS shim methods. The VFS shim modifies the behaviour
** of a standard VFS in the following ways:
**
**   1. Whenever the first page of an OTA target database file is read or 
**      written, the value of the change-counter cookie is stored in
**      sqlite3ota.iCookie. This ensures that, so long as a read transaction
**      is held on the db file, the value of sqlite3ota.iCookie matches
**      that stored on disk.
**
**   2. When the ota handle is in OTA_STAGE_OAL or OTA_STAGE_CKPT state, all
**      EXCLUSIVE lock attempts on the target database fail. This prevents
**      sqlite3_close() from running an automatic checkpoint. Until the
**      ota handle reaches OTA_STAGE_DONE - at that point the automatic
**      checkpoint may be required to delete the *-wal file.
**
**   3. In OTA_STAGE_OAL, the *-shm file is stored in memory. All xShmLock()

**      calls are noops.


**
**   4. In OTA_STAGE_OAL mode, when SQLite calls xAccess() to check if a
**      *-wal file associated with the target database exists, the following
**      special handling applies:
**
**        a) if the *-wal file does exist, return SQLITE_CANTOPEN. An OTA
**           target database may not be in wal mode already.
**
**        b) if the *-wal file does not exist, set the output parameter to
**           non-zero (to tell SQLite that it does exist) anyway.
**
**   5. In OTA_STAGE_OAL mode, if SQLite tries to open a *-wal file 
**      associated with a target database, open the corresponding *-oal file
**      instead.
*/

typedef struct ota_file ota_file;
typedef struct ota_vfs ota_vfs;

struct ota_file {
  sqlite3_file base;              /* sqlite3_file methods */
  sqlite3_file *pReal;            /* Underlying file handle */
  ota_vfs *pOtaVfs;               /* Pointer to the ota_vfs object */