NetworkedApplications: auth-scoped operation outcome lookup endpoint (P-NETWORKED-03)
This commit is contained in:
1 parent
50595bdabc
commit
0f1cf89cfc
10 files changed
+175
-1
No files matched your search
@@ -117,6 +117,31 @@ namespace
|
||||
assert(got.has_value() && got->has_value());
|
||||
assert((*got)->version == 5);
|
||||
}
|
||||
|
||||
void operation_lookup_reports_recorded_outcomes()
|
||||
{
|
||||
MemoryKvStore store;
|
||||
auto applied =
|
||||
store.put("k", "v", Precondition::absent(), {"op-1"});
|
||||
assert(applied.has_value());
|
||||
assert(applied->outcome == WriteOutcome::Applied);
|
||||
|
||||
// A replayed request id resolves to the original outcome.
|
||||
auto replayed = store.put("k", "ignored", Precondition::absent(),
|
||||
{"op-1"});
|
||||
assert(replayed.has_value());
|
||||
assert(replayed->version == applied->version);
|
||||
|
||||
auto known = store.lookup_operation({"op-1"});
|
||||
assert(known.has_value() && known->has_value());
|
||||
assert((*known)->outcome == WriteOutcome::Applied);
|
||||
assert((*known)->version == applied->version);
|
||||
|
||||
// Unknown ids are absent (not an error), and invalid ids are errors.
|
||||
auto absent = store.lookup_operation({"never-used"});
|
||||
assert(absent.has_value() && !absent->has_value());
|
||||
assert(!store.lookup_operation({""}).has_value());
|
||||
}
|
||||
} // namespace
|
||||
|
||||
int main()
|
||||
@@ -125,6 +150,7 @@ int main()
|
||||
input_validation();
|
||||
bounded_scan();
|
||||
bounded_operation_records();
|
||||
operation_lookup_reports_recorded_outcomes();
|
||||
std::puts("networked-kv domain ok");
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user