diff options
Diffstat (limited to 'src/zenserver/projectstore/oplogreferencedset.h')
| -rw-r--r-- | src/zenserver/projectstore/oplogreferencedset.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/zenserver/projectstore/oplogreferencedset.h b/src/zenserver/projectstore/oplogreferencedset.h new file mode 100644 index 000000000..297fd29d5 --- /dev/null +++ b/src/zenserver/projectstore/oplogreferencedset.h @@ -0,0 +1,39 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + +#pragma once + +#include <zencore/uid.h> + +#include <optional> +#include <string_view> +#include <unordered_set> + +namespace zen { + +class IoBuffer; + +/** + * @brief Records which keys in the oplog (entry["op"]["key"]) are in the ReferencedSet reported by the client that uploaded the oplog. + * + * An oplog can contain ops from an earlier incremental cook result that are no longer referenced in the most recent cook; + * the OplogReferencedSet allows clients that need to view only referenced-by-head-cook entries to trim the oplog down to + * those entries. + * + * Keys are case-sensitive; client must ensure that capitalization matches between the ReferencedSet and the oplog keys. + */ +class OplogReferencedSet +{ +public: + void Emplace(Oid OplogId); + bool Contains(Oid OplogId, std::string_view OplogKey); + void Clear(); + + static std::optional<OplogReferencedSet> LoadFromChunk(const IoBuffer& ChunkData); + + static constexpr std::string_view ReferencedSetOplogKey = "ReferencedSet"; + +private: + std::unordered_set<Oid> Set; +}; + +} // namespace zen |