载入中...
搜索中...
未找到
StateAccessAdapter.cpp
浏览该文件的文档.
9eve::Result<eve::MutationReceipt> failure(eve::DiagnosticCode code, std::string message, std::string path = {}) {
14bool isTagKey(std::string_view key) { return key.starts_with("tag.") || key.starts_with("tag:"); }
23std::optional<eve::Value> TagStoreStateAdapter::value(std::string_view subject, std::string_view key) const {
28std::optional<bool> TagStoreStateAdapter::hasTag(std::string_view subject, std::string_view tag) const {
33std::optional<eve::Value> TagStoreStateAdapter::state(std::string_view subject, std::string_view key) const {
37eve::Result<eve::MutationReceipt> TagStoreStateAdapter::apply(std::span<const eve::StateMutation> mutations,
48 if ((mutation.kind == eve::MutationKind::Set) && (!isTagKey(mutation.key) || !mutation.value.isBool()))
49 return failure(eve::DiagnosticCode::InvalidArgument, "tag Set requires a tag.* key and boolean value",
54 return failure(eve::DiagnosticCode::Unsupported, "TagStore supports Set, AddTag, and RemoveTag only",
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.h:81
std::optional< eve::Value > state(std::string_view subject, std::string_view key) const override
Query a persistent/world state value.
Definition StateAccessAdapter.cpp:33
eve::Result< eve::MutationReceipt > apply(std::span< const eve::StateMutation > mutations, const eve::MutationContext &context) override
Apply a complete mutation set atomically.
Definition StateAccessAdapter.cpp:37
std::optional< eve::Value > value(std::string_view subject, std::string_view key) const override
Query a generic world value.
Definition StateAccessAdapter.cpp:23
std::optional< bool > hasTag(std::string_view subject, std::string_view tag) const override
Query exact tag membership.
Definition StateAccessAdapter.cpp:28
bool removeTag(const SubjectId &subject, const std::string &tag)
Removes a tag from a subject.
Definition TagStore.cpp:53
bool hasTag(const SubjectId &subject, const std::string &tag) const
Tests whether a subject has an exact tag.
Definition TagStore.cpp:56
bool addTag(const SubjectId &subject, const std::string &tag)
Adds a tag to a subject.
Definition TagStore.cpp:50
Definition GameplayTag.cpp:9
@ InvalidArgument
@ Unsupported
@ NoOp
@ Applied
Correlation metadata shared by a mutation transaction.
Definition StateAccess.h:57
Observable result of an all-or-nothing mutation request.
Definition StateAccess.h:64
TagStore implementation of the common world-state contracts.