载入中...
搜索中...
未找到
SnapshotHash.h
浏览该文件的文档.
1#pragma once
2
27#include "common/Identity.h"
28#include "common/Result.h"
29#include "common/Snapshot.h"
30
31#include <memory>
32#include <string>
33#include <string_view>
34
35namespace eve {
36
38enum class ContentDigestKind : std::uint8_t {
43};
44
46[[nodiscard]] EVENGINE_API_FOUNDATION std::string_view contentDigestKindName(ContentDigestKind kind) noexcept;
47
55public:
57 static constexpr const char* capabilityName = "eve.ISnapshotContentHasher";
58
60 virtual ~ISnapshotContentHasher() = default;
61
63 [[nodiscard]] virtual std::string_view id() const noexcept = 0;
64
66 [[nodiscard]] virtual ContentDigestKind digestKind() const noexcept = 0;
67
73 [[nodiscard]] virtual Result<ContentId> hash(std::string_view canonicalInput) const = 0;
74};
75
82
92
101
112
117[[nodiscard]] EVENGINE_API std::string_view activeSnapshotHashAlgorithm() noexcept;
118
119} // namespace eve
std::array< std::uint8_t, 32 > hash
Definition Evpack.cpp:172
#define EVENGINE_API_FOUNDATION
每个链接组(link group)各自的导出宏。
Definition Export.h:106
#define EVENGINE_API
宿主(eve / libmain)导出宏;插件从进程导入同一批符号。
Definition Export.h:31
Strong identity values shared by persistence, content and logical-name APIs.
TokenKind kind
Move-only, checked operation results for the common layer.
Versioned, integrity-checked persistence envelopes.
One content-digest implementation usable for snapshot sealing and verification.
virtual ~ISnapshotContentHasher()=default
Releases ISnapshotContentHasher resources.
virtual std::string_view id() const noexcept=0
Stable algorithm id, persisted or logged next to the data it hashed.
static constexpr const char * capabilityName
Capability name a provider registers under.
virtual ContentDigestKind digestKind() const noexcept=0
What this digest guarantees.
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Id128 public API.
Definition Identity.h:112
Build metadata (engine git commit, build time, third-party version).
Definition Build.cpp:16
std::string_view contentDigestKindName(ContentDigestKind kind) noexcept
Stable protocol spelling of a digest kind.
ContentDigestKind
What a digest implementation actually guarantees, stated rather than implied.
@ Cryptographic
A cryptographic digest; the provider documents its algorithm and properties.
@ NonCryptographic
Fast, deterministic, collision-resistant enough for storage identity only.
Result< void > registerBuiltinSnapshotHasher()
Register the built-in hasher, unless a module already registered one.
SnapshotHashProvider snapshotContentHashProvider()
A SnapshotHashProvider backed by the active hasher.
std::shared_ptr< ISnapshotContentHasher > builtinSnapshotContentHasher()
The engine's built-in content hasher.
std::string_view activeSnapshotHashAlgorithm() noexcept
Id of the algorithm snapshotContentHashProvider currently uses.
ISnapshotContentHasher * registeredSnapshotContentHasher() noexcept
The currently registered hasher, if a module registered one.
std::function< Result< ContentId >(std::string_view canonicalInput)> SnapshotHashProvider
Injected content-digest implementation used by snapshots.
Definition Snapshot.h:36