snapshot
来源:互联网 发布:大主宰礼包兑换码 淘宝 编辑:程序博客网 时间:2024/05/16 01:33
// 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 "db/dbformat.h"#include "leveldb/db.h"namespace leveldb {class SnapshotList;// Snapshots are kept in a doubly-linked list in the DB.// Each SnapshotImpl corresponds to a particular sequence number.class SnapshotImpl : public Snapshot {public:SequenceNumber number_; // const after creationprivate:friend class SnapshotList;// SnapshotImpl is kept in a doubly-linked circular listSnapshotImpl* prev_;SnapshotImpl* next_;SnapshotList* list_; // just for sanity checks};class SnapshotList {public:SnapshotList(){list_.prev_ = &list_;list_.next_ = &list_;}bool empty() const { return list_.next_ == &list_; }SnapshotImpl* oldest() const{ assert(!empty());return list_.next_; }SnapshotImpl* newest() const { assert(!empty()); return list_.prev_;}const SnapshotImpl* New(SequenceNumber seq) {SnapshotImpl* s = new SnapshotImpl;s->number_ = seq;s->list_ = this;// 在list_的前面位置插入一个new的对象s->next_ = &list_;s->prev_ = list_.prev_;s->prev_->next_ = s;s->next_->prev_ = s;return s;}void Delete( const SnapshotImpl* 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 snapshotsSnapshotImpl list_;};} // namespace leveldb#endif // STORAGE_LEVELDB_DB_SNAPSHOT_H_
阅读全文
0 0
- Snapshot
- snapshot
- snapshot
- snapshot
- snapshot
- snapshot
- snapshot
- snapshot
- LVM snapshot
- LVM Snapshot
- oracle snapshot
- android Snapshot
- snapshot原理
- Xcode Snapshot
- LVM snapshot
- lightmap Snapshot
- nova snapshot
- HBase Snapshot
- Python pickle模块学习(超级详细)
- 使代码运行在一个单独的线程中的方法
- beans.NotReadablePropertyException
- (编译原理)java实现词法分析器
- require() 源码解读
- snapshot
- 解决Mac上adb: command not found问题
- 解决PhpStorm卡顿的问题
- Android检测设备是否是模拟器
- LeetCode--Set matrix zeros
- 百度统计--优化的--做缓存
- SSM数据库账号密码加密
- 学了redis我能拿你做什么
- Android hideSoftInputFromWindow方法参数中flag如何选用