PIM/MS Windows/SQLite Folder Indices: Difference between revisions

From KDE Community Wiki
Line 33: Line 33:
!NOTES
!NOTES
|-
|-
|KMFolderIndex:indexLocation()
|QString KMFolderIndex::indexLocation()
|yes
|yes
|
|
|added .db suffix to indicate the index is sqlite-based
|added .db suffix to indicate the index is sqlite-based
|-
|int KMFolderIndex::updateIndex()
|yes
|
|no changes
|-
|int KMFolderIndex::writeIndex( bool createEmptyIndex )
|
|
|
|-
|bool KMFolderIndex::readIndex()
|
|
|
|-
|int KMFolderIndex::count(bool cache)
|yes
|
|no changes
|-
|bool KMFolderIndex::readIndexHeader(int *gv)
|
|
|
|-
|bool KMFolderIndex::updateIndexStreamPtr(bool)
|
|
|
|-
|KMFolderIndex::IndexStatus KMFolderIndex::indexStatus()
|
|
|
|-
|void KMFolderIndex::truncateIndex()
|
|
|use "DELETE FROM..."
|-
|off_t KMFolderIndex::mHeaderOffset
|
|
|replace its public use (e.g. in KMFolderIndex::truncateIndex()) with additional bool indexOpened()
|-
|KMFolderIndex::
|
|
|
|-
|KMFolderIndex::
|
|
|
|-
|-
|}
|}

Revision as of 10:20, 23 April 2008

There are issues with locking index files for KMail folders and mmap()/munmap() operations on Windows. Therefore, SQLite-based indices are in development. This page presents detailed development notes for this task.

Started: jstaniek 11:35, 23 April 2008 (CEST)

Introduction

  • we call the new implementation SQLite mode for short
  • SQLite 3.5.4 is used, as provided by emerge sqlite module; we should not allow using much older versions of sqlite, e.g. 3.1 because of file format differences
  • we are using one .index.db file per account, not folder
  • kmfolderindex_sqlite.cpp is created and edited as a copy of kmfolderindex.cpp; kmfolderindex.cpp is not compiled in SQLite mode
  • kmfolderindex.h is a common header for both kmfolderindex*.cpp implementations
  • kmailprivate links to sqlite library, and KMAIL_SQLITE_INDEX is defined to enable #ifdef'd code

KMFolderIndex

api docs

  • 2008-04-23
    • mIndexId unused - removed as well as serialIndexId()
    • indexLocation(): added .db suffix to indicate the index is sqlite-based
    • INDEX_VERSION is written and checked using 'PRAGMA user_version = <integer>' command [1]
    • we do not use temporary filenames, e.g. in writeIndex(): SQLite takes care about safe storage
    • updateIndex() no changes, we're changing implementation of KMMsgBase::syncIndexString() and writeIndex() instead

KMMsgBase

api docs

  • 2008-04-23
    • move syncIndexString() to KMFolderIndex, where we can impleemnt it for SQLite differently

Status of porting to SQLite

TOPIC PORTED TESTED NOTES
QString KMFolderIndex::indexLocation() yes added .db suffix to indicate the index is sqlite-based
int KMFolderIndex::updateIndex() yes no changes
int KMFolderIndex::writeIndex( bool createEmptyIndex )
bool KMFolderIndex::readIndex()
int KMFolderIndex::count(bool cache) yes no changes
bool KMFolderIndex::readIndexHeader(int *gv)
bool KMFolderIndex::updateIndexStreamPtr(bool)
KMFolderIndex::IndexStatus KMFolderIndex::indexStatus()
void KMFolderIndex::truncateIndex() use "DELETE FROM..."
off_t KMFolderIndex::mHeaderOffset replace its public use (e.g. in KMFolderIndex::truncateIndex()) with additional bool indexOpened()
KMFolderIndex::
KMFolderIndex::

Open Questions

  • should we port .sorted files to sqlite too? (possibly to the same .db file)