Skip to content

Commit 2b4152f

Browse files
committed
Test error when writing with faulty environment.
1 parent 4f60c64 commit 2b4152f

5 files changed

Lines changed: 25 additions & 3 deletions

File tree

recipe.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "asyncdb",
3-
"compiler": "g++ -g -Wall -Wextra -Werror -std=c++17",
3+
"compiler": "g++ -g -Wall -Werror -std=c++17",
44
"packaging": "executable",
55
"modules": [],
66
"dependencies":

src/repository/repository.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
#include <set>
55

6-
#include <rocksdb/db.h>
7-
86
#include "table/table.h"
97

108
namespace repository

src/repository/rocksdb_repository.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include <string>
55

6+
#include <rocksdb/db.h>
7+
68
#include "repository.h"
79

810
namespace repository
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "faulty_environment.h"
2+
3+
rocksdb::Status repository::faulty_environment::ReopenWritableFile(
4+
const std::string& f,
5+
std::unique_ptr<rocksdb::WritableFile>* r,
6+
const rocksdb::EnvOptions& o)
7+
{
8+
return rocksdb::Status::IOError("simulated failure");
9+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include <rocksdb/env.h>
2+
#include <rocksdb/db.h>
3+
4+
namespace repository
5+
{
6+
class faulty_environment : public rocksdb::EnvWrapper
7+
{
8+
rocksdb::Status ReopenWritableFile(
9+
const std::string& f,
10+
std::unique_ptr<rocksdb::WritableFile>* r,
11+
const rocksdb::EnvOptions& o) override;
12+
};
13+
}

0 commit comments

Comments
 (0)