aboutsummaryrefslogtreecommitdiffhomepage
path: root/history.h
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-12-02 23:38:38 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-12-02 23:38:38 -0800
commit984a4980635c637057ada3efc9a213c0a1d037a9 (patch)
treed3843cf87733aa259be1aa9bb237e7c1a63eec03 /history.h
parentc1b51c65302f2d2a8008d9d02c40b9bd594cc3e8 (diff)
More work towards incremental history. Added some tests.
Diffstat (limited to 'history.h')
-rw-r--r--history.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/history.h b/history.h
index bd418eb3..3a123cae 100644
--- a/history.h
+++ b/history.h
@@ -8,6 +8,7 @@
#include <wchar.h>
#include "common.h"
#include "pthread.h"
+#include "wutil.h"
#include <vector>
#include <utility>
#include <list>
@@ -120,9 +121,6 @@ private:
/** Deleted item contents. */
std::set<wcstring> deleted_items;
- /** How many items we've added without saving */
- size_t unsaved_item_count;
-
/** The mmaped region for the history file */
const char *mmap_start;
@@ -131,6 +129,9 @@ private:
/** The type of file we mmap'd */
history_file_type_t mmap_type;
+
+ /** The file ID of the file we mmap'd */
+ file_id_t mmap_file_id;
/** Timestamp of when this history was created */
const time_t birth_timestamp;
@@ -159,7 +160,10 @@ private:
bool save_internal_via_appending();
/** Saves history */
- void save_internal();
+ void save_internal(bool vacuum);
+
+ /** Whether we're in maximum chaos mode, useful for testing */
+ bool chaos_mode;
/* Versioned decoding */
static history_item_t decode_item_fish_2_0(const char *base, size_t len);
@@ -184,6 +188,9 @@ public:
/** Saves history */
void save();
+
+ /** Performs a full (non-incremental) save */
+ void save_and_vacuum();
/** Irreversibly clears history */
void clear();