summaryrefslogtreecommitdiff
path: root/db/snapshot.h
diff options
context:
space:
mode:
authordgrogan@chromium.org <dgrogan@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>2011-04-19 23:01:25 +0000
committerdgrogan@chromium.org <dgrogan@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>2011-04-19 23:01:25 +0000
commitb743906eeabc925f3e824d91a9747012bf249e2f (patch)
treee7cb4f854196c43045756469627920e4e7b146c1 /db/snapshot.h
parentb409afe968b6917574ec08e02c4bf6e6f722e3ca (diff)
downloadleveldb-b743906eeabc925f3e824d91a9747012bf249e2f.tar.gz
Revision created by MOE tool push_codebase.
MOE_MIGRATION= git-svn-id: https://leveldb.googlecode.com/svn/trunk@22 62dab493-f737-651d-591e-8d6aee1b9529
Diffstat (limited to 'db/snapshot.h')
-rw-r--r--db/snapshot.h66
1 files changed, 0 insertions, 66 deletions
diff --git a/db/snapshot.h b/db/snapshot.h
deleted file mode 100644
index 9a90756..0000000
--- a/db/snapshot.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file. See the AUTHORS file for names of contributors.
-
-#ifndef STORAGE_LEVELDB_DB_SNAPSHOT_H_
-#define STORAGE_LEVELDB_DB_SNAPSHOT_H_
-
-#include "leveldb/db.h"
-
-namespace leveldb {
-
-class SnapshotList;
-
-// Snapshots are kept in a doubly-linked list in the DB.
-// Each Snapshot corresponds to a particular sequence number.
-class Snapshot {
- public:
- SequenceNumber number_; // const after creation
-
- private:
- friend class SnapshotList;
-
- // Snapshot is kept in a doubly-linked circular list
- Snapshot* prev_;
- Snapshot* next_;
-
- SnapshotList* list_; // just for sanity checks
-};
-
-class SnapshotList {
- public:
- SnapshotList() {
- list_.prev_ = &list_;
- list_.next_ = &list_;
- }
-
- bool empty() const { return list_.next_ == &list_; }
- Snapshot* oldest() const { assert(!empty()); return list_.next_; }
- Snapshot* newest() const { assert(!empty()); return list_.prev_; }
-
- const Snapshot* New(SequenceNumber seq) {
- Snapshot* s = new Snapshot;
- s->number_ = seq;
- s->list_ = this;
- s->next_ = &list_;
- s->prev_ = list_.prev_;
- s->prev_->next_ = s;
- s->next_->prev_ = s;
- return s;
- }
-
- void Delete(const Snapshot* s) {
- assert(s->list_ == this);
- s->prev_->next_ = s->next_;
- s->next_->prev_ = s->prev_;
- delete s;
- }
-
- private:
- // Dummy head of doubly-linked list of snapshots
- Snapshot list_;
-};
-
-}
-
-#endif // STORAGE_LEVELDB_DB_SNAPSHOT_H_