Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: sql/meta_table.h

Issue 1533703002: [sql] Consider fresh databases suitable for memory-mapped I/O. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: eyeroll and 0UL Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sql/connection_unittest.cc ('k') | sql/meta_table.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sql/meta_table.h
diff --git a/sql/meta_table.h b/sql/meta_table.h
index 0ae76bd23e7afaf5cfcffcd1299b5963f8039ef9..85c0c82bab0c71b25acf8c6eeb5baf2b30114d05 100644
--- a/sql/meta_table.h
+++ b/sql/meta_table.h
@@ -21,6 +21,13 @@ class SQL_EXPORT MetaTable {
MetaTable();
~MetaTable();
+ // Values for Get/SetMmapStatus(). |kMmapFailure| indicates that there was at
+ // some point a read error and the database should not be memory-mapped, while
+ // |kMmapSuccess| indicates that the entire file was read at some point and
+ // can be memory-mapped without constraint.
+ static int64_t kMmapFailure;
+ static int64_t kMmapSuccess;
+
// Returns true if the 'meta' table exists.
static bool DoesTableExist(Connection* db);
@@ -38,10 +45,18 @@ class SQL_EXPORT MetaTable {
// transaction.
static void RazeIfDeprecated(Connection* db, int deprecated_version);
+ // Used to tuck some data into the meta table about mmap status. The value
+ // represents how much data in bytes has successfully been read from the
+ // database, or |kMmapFailure| or |kMmapSuccess|.
+ static bool GetMmapStatus(Connection* db, int64_t* status);
+ static bool SetMmapStatus(Connection* db, int64_t status);
+
// Initializes the MetaTableHelper, creating the meta table if necessary. For
// new tables, it will initialize the version number to |version| and the
// compatible version number to |compatible_version|. Versions must be
// greater than 0 to distinguish missing versions (see GetVersionNumber()).
+ // If there was no meta table (proxy for a fresh database), mmap status is set
+ // to |kMmapSuccess|.
bool Init(Connection* db, int version, int compatible_version);
// Resets this MetaTable object, making another call to Init() possible.
« no previous file with comments | « sql/connection_unittest.cc ('k') | sql/meta_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698