|
| | SpecialEnv (Env *base) |
| |
| Status | NewWritableFile (const std::string &f, WritableFile **r) |
| |
| Status | NewRandomAccessFile (const std::string &f, RandomAccessFile **r) |
| |
| | EnvWrapper (Env *t) |
| |
| virtual | ~EnvWrapper () |
| |
| Env * | target () const |
| |
| Status | NewSequentialFile (const std::string &f, SequentialFile **r) |
| |
| Status | NewRandomAccessFile (const std::string &f, RandomAccessFile **r) |
| |
| Status | NewWritableFile (const std::string &f, WritableFile **r) |
| |
| Status | NewAppendableFile (const std::string &f, WritableFile **r) |
| |
| bool | FileExists (const std::string &f) |
| |
| Status | GetChildren (const std::string &dir, std::vector< std::string > *r) |
| |
| Status | DeleteFile (const std::string &f) |
| |
| Status | CreateDir (const std::string &d) |
| |
| Status | DeleteDir (const std::string &d) |
| |
| Status | GetFileSize (const std::string &f, uint64_t *s) |
| |
| Status | RenameFile (const std::string &s, const std::string &t) |
| |
| Status | LockFile (const std::string &f, FileLock **l) |
| |
| Status | UnlockFile (FileLock *l) |
| |
| void | Schedule (void(*f)(void *), void *a) |
| |
| void | StartThread (void(*f)(void *), void *a) |
| |
| virtual Status | GetTestDirectory (std::string *path) |
| |
| virtual Status | NewLogger (const std::string &fname, Logger **result) |
| |
| uint64_t | NowMicros () |
| |
| void | SleepForMicroseconds (int micros) |
| |
| | Env () |
| |
| virtual | ~Env () |
| |
| virtual void | Schedule (void(*function)(void *arg), void *arg)=0 |
| |
| virtual void | StartThread (void(*function)(void *arg), void *arg)=0 |
| |
Definition at line 58 of file db_test.cc.
§ SpecialEnv()
| leveldb::SpecialEnv::SpecialEnv |
( |
Env * |
base | ) |
|
|
inlineexplicit |
Definition at line 81 of file db_test.cc.
port::AtomicPointer delay_data_sync_
port::AtomicPointer manifest_write_error_
port::AtomicPointer non_writable_
port::AtomicPointer no_space_
port::AtomicPointer data_sync_error_
port::AtomicPointer manifest_sync_error_
§ NewRandomAccessFile()
Implements leveldb::Env.
Definition at line 164 of file db_test.cc.
165 class CountingFile :
public RandomAccessFile {
168 AtomicCounter* counter_;
170 CountingFile(RandomAccessFile*
target, AtomicCounter* counter)
171 : target_(target), counter_(counter) {
173 virtual ~CountingFile() {
delete target_; }
174 virtual Status Read(uint64_t offset,
size_t n, Slice* result,
175 char* scratch)
const {
176 counter_->Increment();
177 return target_->Read(offset, n, result, scratch);
virtual Status NewRandomAccessFile(const std::string &fname, RandomAccessFile **result)=0
AtomicCounter random_read_counter_
§ NewWritableFile()
Implements leveldb::Env.
Definition at line 91 of file db_test.cc.
92 class DataFile :
public WritableFile {
102 ~DataFile() {
delete base_; }
103 Status Append(
const Slice& data) {
104 if (env_->no_space_.Acquire_Load() != NULL) {
108 return base_->Append(data);
111 Status Close() {
return base_->Close(); }
112 Status Flush() {
return base_->Flush(); }
114 if (env_->data_sync_error_.Acquire_Load() != NULL) {
117 while (env_->delay_data_sync_.Acquire_Load() != NULL) {
120 return base_->Sync();
123 class ManifestFile :
public WritableFile {
128 ManifestFile(
SpecialEnv* env, WritableFile* b) : env_(env), base_(b) { }
129 ~ManifestFile() {
delete base_; }
130 Status Append(
const Slice& data) {
131 if (env_->manifest_write_error_.Acquire_Load() != NULL) {
134 return base_->Append(data);
137 Status Close() {
return base_->Close(); }
138 Status Flush() {
return base_->Flush(); }
140 if (env_->manifest_sync_error_.Acquire_Load() != NULL) {
143 return base_->Sync();
154 if (strstr(f.c_str(),
".ldb") != NULL ||
155 strstr(f.c_str(),
".log") != NULL) {
156 *r =
new DataFile(
this, *r);
157 }
else if (strstr(f.c_str(),
"MANIFEST") != NULL) {
158 *r =
new ManifestFile(
this, *r);
virtual Status NewWritableFile(const std::string &fname, WritableFile **result)=0
port::AtomicPointer non_writable_
static Status IOError(const Slice &msg, const Slice &msg2=Slice())
void DelayMilliseconds(int millis)
§ count_random_reads_
| bool leveldb::SpecialEnv::count_random_reads_ |
§ data_sync_error_
| port::AtomicPointer leveldb::SpecialEnv::data_sync_error_ |
§ delay_data_sync_
| port::AtomicPointer leveldb::SpecialEnv::delay_data_sync_ |
§ manifest_sync_error_
| port::AtomicPointer leveldb::SpecialEnv::manifest_sync_error_ |
§ manifest_write_error_
| port::AtomicPointer leveldb::SpecialEnv::manifest_write_error_ |
§ no_space_
| port::AtomicPointer leveldb::SpecialEnv::no_space_ |
§ non_writable_
| port::AtomicPointer leveldb::SpecialEnv::non_writable_ |
§ random_read_counter_
| AtomicCounter leveldb::SpecialEnv::random_read_counter_ |
The documentation for this class was generated from the following file: