Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bindings/c/test/mako/mako.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,9 @@ int parseTransaction(Arguments& args, char const* optarg) {
} else if (strncmp(ptr, "g", 1) == 0) {
op = OP_GET;
ptr++;
} else if (strncmp(ptr, "sj", 2) == 0) {
op = OP_STATUSJSON;
ptr += 2;
} else if (strncmp(ptr, "sgr", 3) == 0) {
op = OP_SGETRANGE;
rangeop = 1;
Expand Down
1 change: 1 addition & 0 deletions bindings/c/test/mako/mako.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ enum OpKind {
OP_GETRANGE,
OP_SGET,
OP_SGETRANGE,
OP_STATUSJSON,
OP_UPDATE,
OP_INSERT,
OP_INSERTRANGE,
Expand Down
1 change: 1 addition & 0 deletions bindings/c/test/mako/mako.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ Operation Types
- ``gr`` – GET RANGE
- ``sg`` – Snapshot GET
- ``sgr`` – Snapshot GET RANGE
- ``sj`` – GET ``\xff\xff/status/json`` from the special key space
- ``u`` – Update (= GET followed by SET)
- ``i`` – Insert (= SET with a new key)
- ``ir`` – Insert Range (Sequential)
Expand Down
14 changes: 14 additions & 0 deletions bindings/c/test/mako/operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,20 @@ const std::array<Operation, MAX_OP> opTable{ {
} } },
1,
false },
{ "STATUSJSON",
{ { StepKind::READ,
[](Transaction& tx, Arguments const&, ByteString&, ByteString&, ByteString&) {
static constexpr auto status_json_key =
std::string_view{ "\xff\xff/status/json", sizeof("\xff\xff/status/json") - 1 };
return tx.get(toBytesRef(status_json_key), false /*snapshot*/).eraseType();
},
[](Future& f, Transaction&, Arguments const&, ByteString&, ByteString&, ByteString&) {
if (f && !f.error()) {
f.get<future_var::ValueRef>();
}
} } },
1,
false },
{ "UPDATE",
{ { StepKind::READ,
[](Transaction& tx, Arguments const& args, ByteString& key, ByteString&, ByteString&) {
Expand Down
14 changes: 1 addition & 13 deletions documentation/coro_tutorial/tutorial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,17 +554,6 @@ Future<Void> fdbClient() {
}
}

Future<Void> fdbStatusStresser() {
Database db = Database::createDatabase(clusterFile, 300);
Key statusJson(std::string("\xff\xff/status/json"));
loop {
co_await runRYWTransaction(db, [&statusJson](ReadYourWritesTransaction* tr) -> Future<Void> {
co_await tr->get(statusJson);
co_return;
});
}
}

AsyncGenerator<Optional<StringRef>> readBlocks(Reference<IAsyncFile> file, int64_t blockSize) {
auto sz = co_await file->size();
decltype(sz) offset = 0;
Expand Down Expand Up @@ -645,9 +634,8 @@ std::unordered_map<std::string, std::function<Future<Void>()>> actors = {
{ "fdbClientStream", &fdbClientStream }, // ./tutorial -C $CLUSTER_FILE_PATH fdbClientStream
{ "fdbClientGetRange", &fdbClientGetRange }, // ./tutorial -C $CLUSTER_FILE_PATH fdbClientGetRange
{ "fdbClient", &fdbClient }, // ./tutorial -C $CLUSTER_FILE_PATH fdbClient
{ "fdbStatusStresser", &fdbStatusStresser },
{ "testReadLines", &testReadLines }
}; // ./tutorial -C $CLUSTER_FILE_PATH fdbStatusStresser
};

int main(int argc, char* argv[]) {
bool isServer = false;
Expand Down
19 changes: 2 additions & 17 deletions documentation/tutorial/tutorial.actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,20 +518,6 @@ ACTOR Future<Void> fdbClient() {
}
}

ACTOR Future<Void> fdbStatusStresser() {
state Database db = Database::createDatabase(clusterFile, 300);
state ReadYourWritesTransaction tx(db);
state Key statusJson(std::string("\xff\xff/status/json"));
loop {
try {
tx.reset();
Optional<Value> _ = wait(tx.get(statusJson));
} catch (Error& e) {
wait(tx.onError(e));
}
}
}

std::unordered_map<std::string, std::function<Future<Void>()>> actors = {
{ "timer", &simpleTimer }, // ./tutorial timer
{ "promiseDemo", &promiseDemo }, // ./tutorial promiseDemo
Expand All @@ -543,9 +529,8 @@ std::unordered_map<std::string, std::function<Future<Void>()>> actors = {
{ "multipleClients", &multipleClients }, // ./tutorial -s 127.0.0.1:6666 multipleClients
{ "fdbClientStream", &fdbClientStream }, // ./tutorial -C $CLUSTER_FILE_PATH fdbClientStream
{ "fdbClientGetRange", &fdbClientGetRange }, // ./tutorial -C $CLUSTER_FILE_PATH fdbClientGetRange
{ "fdbClient", &fdbClient }, // ./tutorial -C $CLUSTER_FILE_PATH fdbClient
{ "fdbStatusStresser", &fdbStatusStresser }
}; // ./tutorial -C $CLUSTER_FILE_PATH fdbStatusStresser
{ "fdbClient", &fdbClient } // ./tutorial -C $CLUSTER_FILE_PATH fdbClient
};

int main(int argc, char* argv[]) {
bool isServer = false;
Expand Down