载入中...
搜索中...
未找到
EditorAssetDatabase.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
6
7#include <optional>
8#include <string>
9#include <unordered_map>
10#include <vector>
11
12namespace eve::editor {
13
16
20 std::string logicalUri;
21 std::string typeId;
22 std::uint32_t schemaVersion = 1;
23 std::string sourceUri;
24 std::string sourceHash;
25 std::string importerId;
26 std::uint32_t importerVersion = 1;
27 std::vector<std::string> artifacts;
28 std::vector<std::string> tags;
31 std::vector<EditorDiagnostic> diagnostics;
32};
33
36
44
48 std::vector<AssetDependency> dependencies;
49};
50
52struct AssetQuery {
53 std::vector<std::string> typeIds;
54 std::vector<std::string> pathPrefixes;
55 std::vector<std::string> tagsAll;
56 std::string text;
57 std::optional<AssetStatus> status;
58};
59
61template <class T>
63struct AssetPage {
64 std::vector<T> values;
65 std::size_t nextOffset = 0;
66 bool hasMore = false;
67 std::uint64_t generation = 0;
68};
69
72public:
74 Result<AssetRecord> publish(AssetRecord record, std::vector<AssetDependency> dependencies = {});
79 [[nodiscard]] Result<std::vector<AssetRecord>> publishBatch(std::vector<AssetPublication> publications);
81 Result<AssetRecord> find(const AssetGuid& guid) const;
83 Result<AssetRecord> findByUri(const std::string& logicalUri) const;
85 Result<AssetPage<AssetRecord>> query(const AssetQuery& query, std::size_t offset, std::size_t limit,
86 std::optional<std::uint64_t> generation = std::nullopt) const;
88 std::vector<AssetDependency> dependencies(const AssetGuid& guid, bool incoming = false) const;
90 std::uint64_t generation() const { return generation_; }
91
92private:
93 std::unordered_map<AssetGuid, AssetRecord, StrongEditorIdHash<AssetGuid>> records_;
94 std::unordered_map<std::string, AssetGuid> uriToGuid_;
95 std::vector<AssetDependency> dependencies_;
96 std::uint64_t generation_ = 0;
97};
98
102 std::vector<AssetDependency> dependencies;
103};
104
108 std::uint64_t generation = 0;
109 std::string sourceHash;
110 std::string importerId;
111 std::uint32_t importerVersion = 1;
112};
113
116public:
118 explicit ImportCoordinator(MemoryAssetDatabase* database) : database_(database) {}
120 Result<AssetRecord> publish(ImportProduct product);
122 Result<ImportTicket> begin(const AssetGuid& asset, std::string sourceHash,
123 std::string importerId, std::uint32_t importerVersion);
125 Result<AssetRecord> publish(const ImportTicket& ticket, ImportProduct product);
126
127private:
128 MemoryAssetDatabase* database_ = nullptr;
129 std::unordered_map<AssetGuid, std::uint64_t, StrongEditorIdHash<AssetGuid>> generations_;
130};
131
132} // namespace eve::editor
#define EVENGINE_API_ORCHESTRATION
Definition Export.h:111
size_t offset
std::uint32_t generation
float begin
int limit
Definition TreeMesh.cpp:164
Move-only operation result carrying either a value or Status.
Definition Result.h:155
UUID-backed identifier adapter for legacy textual boundaries.
Definition Identity.h:314
Dotted property path (layout.size) compared and persisted as text.
Definition EditingIds.h:78
Deterministic owning value tree shared by authoring hosts.
Small coordinator that validates importer output before atomic index publication.
ImportCoordinator(MemoryAssetDatabase *database)
Import coordinator.
Thread-neutral in-memory asset index used by editor hosts and tests.
std::uint64_t generation() const
Return the monotonic index generation.
DependencyKind
Semantic relationship used for dependency closure and deletion planning.
AssetStatus
Current indexing/import health of an asset record.
Directed dependency between two stable asset identities.
One page of values tied to an asset index generation.
One owning record/dependency unit staged for an atomic index generation.
std::vector< AssetDependency > dependencies
Deterministic filter used by headless and UI asset queries.
std::optional< AssetStatus > status
std::vector< std::string > pathPrefixes
std::vector< std::string > tagsAll
std::vector< std::string > typeIds
Value snapshot stored by the editor asset index.
std::vector< std::string > artifacts
std::vector< std::string > tags
std::vector< EditorDiagnostic > diagnostics
Validated importer output staged before publishing to AssetDB.
std::vector< AssetDependency > dependencies
Generation-qualified import request used to reject stale worker products.