深入探索 InoDb 类与 SnapShot 应用
1. InoDb 类简介
InoDb 类继承自 Dbm 类,是一个专门用于处理索引节点数据库的类。它使用设备号和 i - 节点号作为每条记录的键,每条记录的数据类型为 struct stat
。以下是 InoDb 类的声明:
// InoDb.h
#ifndef _InoDb_h_
#define _InoDb_h_
#include <sys/types.h>
#include <sys/stat.h>
#include "Dbm.h"
// Specialized Database Class for an Inode Database :
class InoDb : public Dbm {
public:
struct Key {
dev_t st_dev; // Device number
ino_t st_ino; // Inode number
} ;
protected:
Key ikey; // Internal key
public:
InoDb &fetchKey(Key &key,struct stat &sbuf);
InoDb &insertKey(Key &key,struct stat &sbuf);
InoDb &replaceKey(Key &key,struct stat &sbuf);
I