ludus::content::identity_records¶
Ludus Wiki · API overview · Browse API
Namespace
Related declarations¶
- ludus::content::identity_records::EntityReferenceProperty
- ludus::content::identity_records::IdentityRecordError
- ludus::content::identity_records::MigrationDocument
- ludus::content::identity_records::MigrationManifest
- ludus::content::identity_records::MigrationObject
- ludus::content::identity_records::MigrationSource
Enumerations¶
IdentityRecordStatus¶
enum class IdentityRecordStatus : uint8
Related types: uint8
Success¶
Success
Malformed¶
Malformed
UnsupportedVersion¶
UnsupportedVersion
format, envelope version or another versioned field is not supported. Unsupported¶
Unsupported
InvalidIdentity¶
InvalidIdentity
DuplicateIdentity¶
DuplicateIdentity
InvalidLegacyId¶
InvalidLegacyId
UnknownDocument¶
UnknownDocument
StaleManifest¶
StaleManifest
UnresolvedReference¶
UnresolvedReference
Limit¶
Limit
OutOfMemory¶
OutOfMemory
EntropyUnavailable¶
EntropyUnavailable
IdentityConflict¶
IdentityConflict
AlreadyExists¶
AlreadyExists
IoError¶
IoError
Constants and variables¶
MIGRATION_MANIFEST_FORMAT¶
constexpr std::string_view ludus::content::identity_records::MIGRATION_MANIFEST_FORMAT = "ludus.identity-migration"
format member. MIGRATION_MANIFEST_VERSION¶
constexpr uint64 ludus::content::identity_records::MIGRATION_MANIFEST_VERSION = 1
version this reader and writer support. Related types: uint64
MAX_MANIFEST_BYTES¶
constexpr usize ludus::content::identity_records::MAX_MANIFEST_BYTES = usize{1024} * 1024
Related types: usize
MAX_MANIFEST_DOCUMENTS¶
constexpr usize ludus::content::identity_records::MAX_MANIFEST_DOCUMENTS = 64
Related types: usize
MAX_DOCUMENT_OBJECTS¶
constexpr usize ludus::content::identity_records::MAX_DOCUMENT_OBJECTS = 128
Related types: usize
MAX_LEGACY_ID_BYTES¶
constexpr usize ludus::content::identity_records::MAX_LEGACY_ID_BYTES = 64
Related types: usize
MAX_WORLD_DOCUMENT_BYTES¶
constexpr usize ludus::content::identity_records::MAX_WORLD_DOCUMENT_BYTES = usize{512} * 1024
Related types: usize
MAX_UUID_GENERATION_ATTEMPTS¶
constexpr usize ludus::content::identity_records::MAX_UUID_GENERATION_ATTEMPTS = 4
Related types: usize
WORLD_RECORD_VERSION_1¶
constexpr uint64 ludus::content::identity_records::WORLD_RECORD_VERSION_1 = 1
Related types: uint64
Declared in modules/content/identity_records/include/ludus/content/identity_records/world_records.h
WORLD_RECORD_VERSION_2¶
constexpr uint64 ludus::content::identity_records::WORLD_RECORD_VERSION_2 = 2
Related types: uint64
Declared in modules/content/identity_records/include/ludus/content/identity_records/world_records.h
MAX_WORLD_SCHEMA_BYTES¶
constexpr usize ludus::content::identity_records::MAX_WORLD_SCHEMA_BYTES = usize{64} * 1024
Related types: usize
Declared in modules/content/identity_records/include/ludus/content/identity_records/world_records.h
Functions¶
GetIdentityRecordStatusName¶
std::string_view ludus::content::identity_records::GetIdentityRecordStatusName(IdentityRecordStatus status) noexcept
Related types: IdentityRecordStatus
IsLegacyId¶
bool ludus::content::identity_records::IsLegacyId(std::string_view text) noexcept
_, -, . or :. This is the Editor's World ID rule; the world-demo sample's [a-z0-9-]{1,31} IDs are a subset. GenerateMigrationManifest¶
IdentityRecordStatus ludus::content::identity_records::GenerateMigrationManifest(std::span< const MigrationSource > sources, const foundation::identity::EntropySource &entropy, MigrationManifest &outManifest, IdentityRecordError &outError) noexcept
| Parameter | Description |
|---|---|
sources |
Documents to migrate; paths must be distinct.
|
entropy |
Production code passes platform::GetSystemEntropySource(); tests inject controlled sources. There is no fallback generator.
|
outManifest |
Replaced on success; unchanged on failure.
|
outError |
Receives the failure; reset to Success on success.
|
Returns
Related types: MigrationManifest · IdentityRecordStatus · IdentityRecordError · MigrationSource · foundation::identity::EntropySource
PublishMigrationManifest¶
IdentityRecordStatus ludus::content::identity_records::PublishMigrationManifest(std::string_view root, std::string_view path, const MigrationManifest &manifest, IdentityRecordError &outError) noexcept
path. | Parameter | Description |
|---|---|
root |
Trusted existing native content root.
|
path |
Manifest path relative to
root; its parent directory must exist. |
manifest |
Validated manifest to publish.
|
outError |
Receives the failure; reset to Success on success.
|
Returns
Note
Related types: MigrationManifest · IdentityRecordStatus · IdentityRecordError
ReadEntityReferenceProperties¶
IdentityRecordStatus ludus::content::identity_records::ReadEntityReferenceProperties(std::string_view schemaJson, foundation::Array< EntityReferenceProperty > &outProperties, IdentityRecordError &outError) noexcept
entity-typed properties of a World schema. components[].id and components[].properties[] with id and type) and ignores the other members, which the Editor validates. | Parameter | Description |
|---|---|
schemaJson |
World schema text, at most MAX_WORLD_SCHEMA_BYTES.
|
outProperties |
Replaced on success, in schema order; unchanged on failure.
|
outError |
Receives the failure; reset to Success on success.
|
Returns
Related types: IdentityRecordStatus · foundation::Array · EntityReferenceProperty · IdentityRecordError
Declared in modules/content/identity_records/include/ludus/content/identity_records/world_records.h
ApplyWorldMigration¶
IdentityRecordStatus ludus::content::identity_records::ApplyWorldMigration(const MigrationManifest &manifest, const MigrationSource &source, std::span< const EntityReferenceProperty > references, Bytes &outWorldJson, IdentityRecordError &outError) noexcept
{"version": 2, "schema", "document": <AssetId>, "entities": [{"uuid", "label", "name", "components"}]}. Each entity's version-1 id becomes its label; uuid is the manifest's SourceObjectId for that ID. A nonempty value of a property listed in references is rewritten from the target's legacy ID to the target's UUID; an empty value stays empty (no target). Entity order, the display name and every other value are preserved; output uses two-space indentation and a trailing newline. Replay is pure: it mints nothing, reads no files, and the same inputs always produce the same bytes.scene extension, whose parent links are not yet migrated, report Unsupported. | Parameter | Description |
|---|---|
manifest |
Committed manifest.
|
source |
The document's path as recorded in the manifest, and its version-1 World JSON (at most MAX_WORLD_DOCUMENT_BYTES).
|
references |
Entity-typed properties, normally from ReadEntityReferenceProperties().
|
outWorldJson |
Replaced on success; unchanged on failure.
|
outError |
Receives the failure; reset to Success on success.
|
Returns
Related types: Bytes · MigrationManifest · IdentityRecordStatus · EntityReferenceProperty · IdentityRecordError · MigrationSource
Declared in modules/content/identity_records/include/ludus/content/identity_records/world_records.h
DuplicateEntities¶
IdentityRecordStatus ludus::content::identity_records::DuplicateEntities(std::string_view recordJson, std::string_view schemaJson, std::span< const std::string_view > selected, const foundation::identity::EntropySource &entropy, Bytes &outRecordJson, IdentityRecordError &outError) noexcept
- A fresh
SourceObjectIdis minted for each selected entity with TryGenerateUuidV4 andentropy, checked against every identity already in the record and those minted so far. A colliding candidate is regenerated at most MAX_UUID_GENERATION_ATTEMPTS times before IdentityConflict is reported. - The old-to-new table is built, the selected entities are cloned, and inside each clone every entity-typed reference whose target is in the copied set is rewritten to the target's new UUID. References to entities outside the copied set are deliberately retained unchanged.
- The clones are appended to the record and the whole document is re-emitted.
outRecordJson is unchanged. Only durable SourceObjectId values are produced; no runtime handle, owner, slot or generation is read or written. Each clone's label is left equal to the source's; callers that need unique labels assign them separately.| Parameter | Description |
|---|---|
recordJson |
A version-2 World record (at most MAX_WORLD_DOCUMENT_BYTES).
|
schemaJson |
The World schema identifying the entity-typed properties.
|
selected |
The canonical UUID texts of the entities to duplicate; each must be an entity of the record and each must be distinct.
|
entropy |
The injected entropy source used to mint the new UUIDs.
|
outRecordJson |
Replaced with the version-2 record that also contains the clones on success; unchanged on failure.
|
outError |
Receives the failure; reset to Success on success.
|
Returns
Related types: Bytes · IdentityRecordStatus · IdentityRecordError · foundation::identity::EntropySource
Declared in modules/content/identity_records/include/ludus/content/identity_records/world_records.h