跳转至

GFSaveProfileResult

API Reference / Save / 类索引

  • 路径:addons/gf/extensions/save/profile/gf_save_profile_result.gd
  • 模块:Save
  • 继承:RefCounted
  • API:public
  • 类别:值对象 (value_object)
  • 首次版本:unreleased

Save Profile 操作的不可变终态快照。 结果同时保留 profile generation、底层存储结果、迁移/校验证据和回滚错误, 调用方无需从错误文本反推失败阶段。

成员概览

类型 名称 签名
常量 STATUS_SAVED const STATUS_SAVED: StringName = &"saved"
常量 STATUS_LOADED const STATUS_LOADED: StringName = &"loaded"
常量 STATUS_FLUSHED const STATUS_FLUSHED: StringName = &"flushed"
常量 STATUS_RECOVERED const STATUS_RECOVERED: StringName = &"recovered"
常量 STATUS_INVALID_PROFILE const STATUS_INVALID_PROFILE: StringName = &"invalid_profile"
常量 STATUS_UNSUPPORTED_OPERATION const STATUS_UNSUPPORTED_OPERATION: StringName = &"unsupported_operation"
常量 STATUS_BUSY const STATUS_BUSY: StringName = &"busy"
常量 STATUS_GATHER_FAILED const STATUS_GATHER_FAILED: StringName = &"gather_failed"
常量 STATUS_SNAPSHOT_FAILED const STATUS_SNAPSHOT_FAILED: StringName = &"snapshot_failed"
常量 STATUS_STORAGE_FAILED const STATUS_STORAGE_FAILED: StringName = &"storage_failed"
常量 STATUS_MISSING const STATUS_MISSING: StringName = &"missing"
常量 STATUS_CORRUPT const STATUS_CORRUPT: StringName = &"corrupt"
常量 STATUS_SCHEMA_MISMATCH const STATUS_SCHEMA_MISMATCH: StringName = &"schema_mismatch"
常量 STATUS_FUTURE_SCHEMA const STATUS_FUTURE_SCHEMA: StringName = &"future_schema"
常量 STATUS_MIGRATION_FAILED const STATUS_MIGRATION_FAILED: StringName = &"migration_failed"
常量 STATUS_VALIDATION_FAILED const STATUS_VALIDATION_FAILED: StringName = &"validation_failed"
常量 STATUS_APPLY_FAILED const STATUS_APPLY_FAILED: StringName = &"apply_failed"
常量 STATUS_ROLLBACK_FAILED const STATUS_ROLLBACK_FAILED: StringName = &"rollback_failed"
常量 STATUS_DISPOSED const STATUS_DISPOSED: StringName = &"disposed"
常量 STATUS_OUTCOME_UNKNOWN const STATUS_OUTCOME_UNKNOWN: StringName = &"outcome_unknown"
方法 is_successful func is_successful() -> bool:
方法 get_status func get_status() -> StringName:
方法 get_operation func get_operation() -> StringName:
方法 get_profile_id func get_profile_id() -> StringName:
方法 get_requested_generation func get_requested_generation() -> int:
方法 get_persisted_generation func get_persisted_generation() -> int:
方法 get_attempt_count func get_attempt_count() -> int:
方法 was_coalesced func was_coalesced() -> bool:
方法 was_recovered func was_recovered() -> bool:
方法 get_recovery_action func get_recovery_action() -> StringName:
方法 get_failed_section_id func get_failed_section_id() -> StringName:
方法 get_error_code func get_error_code() -> Error:
方法 get_error func get_error() -> String:
方法 get_document func get_document() -> GFSaveDocument:
方法 get_storage_result func get_storage_result() -> GFStorageReadResult:
方法 get_migration_result func get_migration_result() -> GFSaveMigrationResult:
方法 get_validation_report func get_validation_report() -> Dictionary:
方法 get_rollback_errors func get_rollback_errors() -> Array[GFSaveRollbackFailure]:
方法 get_duration_msec func get_duration_msec() -> int:
方法 get_metadata func get_metadata() -> Dictionary:
方法 get_storage_request_ids func get_storage_request_ids() -> PackedInt64Array:
方法 to_dict func to_dict() -> Dictionary:
方法 duplicate_result func duplicate_result() -> GFSaveProfileResult:

常量

STATUS_SAVED

  • API:public
  • 首次版本:unreleased
const STATUS_SAVED: StringName = &"saved"

保存 generation 已持久化。

STATUS_LOADED

  • API:public
  • 首次版本:unreleased
const STATUS_LOADED: StringName = &"loaded"

文档已迁移、校验并应用。

STATUS_FLUSHED

  • API:public
  • 首次版本:unreleased
const STATUS_FLUSHED: StringName = &"flushed"

flush 目标 generation 已持久化。

STATUS_RECOVERED

  • API:public
  • 首次版本:unreleased
const STATUS_RECOVERED: StringName = &"recovered"

恢复政策保留了当前内存状态。

STATUS_INVALID_PROFILE

  • API:public
  • 首次版本:unreleased
const STATUS_INVALID_PROFILE: StringName = &"invalid_profile"

Profile 配置或请求无效。

STATUS_UNSUPPORTED_OPERATION

  • API:public
  • 首次版本:unreleased
const STATUS_UNSUPPORTED_OPERATION: StringName = &"unsupported_operation"

当前 Profile 不支持请求的操作。

STATUS_BUSY

  • API:public
  • 首次版本:unreleased
const STATUS_BUSY: StringName = &"busy"

请求与正在执行的加载或 Provider 回调冲突。

STATUS_GATHER_FAILED

  • API:public
  • 首次版本:unreleased
const STATUS_GATHER_FAILED: StringName = &"gather_failed"

section 保存采集失败。

STATUS_SNAPSHOT_FAILED

  • API:public
  • 首次版本:unreleased
const STATUS_SNAPSHOT_FAILED: StringName = &"snapshot_failed"

section 应用前快照采集失败。

STATUS_STORAGE_FAILED

  • API:public
  • 首次版本:unreleased
const STATUS_STORAGE_FAILED: StringName = &"storage_failed"

底层存储启动或执行失败。

STATUS_MISSING

  • API:public
  • 首次版本:unreleased
const STATUS_MISSING: StringName = &"missing"

存档文件不存在。

STATUS_CORRUPT

  • API:public
  • 首次版本:unreleased
const STATUS_CORRUPT: StringName = &"corrupt"

存档文档损坏或完整性失败。

STATUS_SCHEMA_MISMATCH

  • API:public
  • 首次版本:unreleased
const STATUS_SCHEMA_MISMATCH: StringName = &"schema_mismatch"

文档 schema ID 与 profile 不匹配。

STATUS_FUTURE_SCHEMA

  • API:public
  • 首次版本:unreleased
const STATUS_FUTURE_SCHEMA: StringName = &"future_schema"

文档或 section 来自未来 schema。

STATUS_MIGRATION_FAILED

  • API:public
  • 首次版本:unreleased
const STATUS_MIGRATION_FAILED: StringName = &"migration_failed"

旧版本文档迁移失败或缺少迁移链。

STATUS_VALIDATION_FAILED

  • API:public
  • 首次版本:unreleased
const STATUS_VALIDATION_FAILED: StringName = &"validation_failed"

当前版本文档校验失败。

STATUS_APPLY_FAILED

  • API:public
  • 首次版本:unreleased
const STATUS_APPLY_FAILED: StringName = &"apply_failed"

section provider 应用失败且回滚成功。

STATUS_ROLLBACK_FAILED

  • API:public
  • 首次版本:unreleased
const STATUS_ROLLBACK_FAILED: StringName = &"rollback_failed"

section provider 应用失败且至少一个回滚失败。

STATUS_DISPOSED

  • API:public
  • 首次版本:unreleased
const STATUS_DISPOSED: StringName = &"disposed"

Utility 释放时操作仍未完成。

STATUS_OUTCOME_UNKNOWN

  • API:public
  • 首次版本:unreleased
const STATUS_OUTCOME_UNKNOWN: StringName = &"outcome_unknown"

写入已提交到底层但无法确认最终磁盘副作用。

方法

is_successful

  • API:public
  • 首次版本:unreleased
func is_successful() -> bool:

检查操作是否成功。

返回:成功终态返回 true。

get_status

  • API:public
  • 首次版本:unreleased
func get_status() -> StringName:

获取稳定终态状态。

返回:STATUS_* 常量之一。

get_operation

  • API:public
  • 首次版本:unreleased
func get_operation() -> StringName:

获取操作类型。

返回:save、load 或 flush。

get_profile_id

  • API:public
  • 首次版本:unreleased
func get_profile_id() -> StringName:

获取 profile ID。

返回:profile ID。

get_requested_generation

  • API:public
  • 首次版本:unreleased
func get_requested_generation() -> int:

获取调用方请求时的 generation。

返回:非负 generation。

get_persisted_generation

  • API:public
  • 首次版本:unreleased
func get_persisted_generation() -> int:

获取终态时已持久化的 generation。

返回:非负 generation。

get_attempt_count

  • API:public
  • 首次版本:unreleased
func get_attempt_count() -> int:

获取底层 IO 尝试次数。

返回:未启动 IO 时为 0。

was_coalesced

  • API:public
  • 首次版本:unreleased
func was_coalesced() -> bool:

检查保存请求是否由更新 generation 的写入覆盖完成。

返回:被合并时返回 true。

was_recovered

  • API:public
  • 首次版本:unreleased
func was_recovered() -> bool:

检查是否通过恢复政策保留了当前状态。

返回:使用恢复动作时返回 true。

get_recovery_action

  • API:public
  • 首次版本:unreleased
func get_recovery_action() -> StringName:

获取实际恢复动作。

返回:未恢复时为空。

get_failed_section_id

  • API:public
  • 首次版本:unreleased
func get_failed_section_id() -> StringName:

获取首个失败 section ID。

返回:非 section 失败时为空。

get_error_code

  • API:public
  • 首次版本:unreleased
func get_error_code() -> Error:

获取 Godot Error 码。

返回:成功时为 OK。

get_error

  • API:public
  • 首次版本:unreleased
func get_error() -> String:

获取稳定错误描述。

返回:成功时为空。

get_document

  • API:public
  • 首次版本:unreleased
func get_document() -> GFSaveDocument:

获取最终文档副本。

返回:已采集或加载文档;不可用时为 null。

get_storage_result

  • API:public
  • 首次版本:unreleased
func get_storage_result() -> GFStorageReadResult:

获取底层读取结果副本。

返回:load 操作的原始读取结果;其他操作或读取未启动时为 null。

get_migration_result

  • API:public
  • 首次版本:unreleased
func get_migration_result() -> GFSaveMigrationResult:

获取迁移结果副本。

返回:执行迁移时的结果;否则为 null。

get_validation_report

  • API:public
  • 首次版本:unreleased
func get_validation_report() -> Dictionary:

获取最终校验报告副本。

返回:结构化校验报告。

结构:

  • return: GFValidationReportDictionary-compatible report or an empty Dictionary.

get_rollback_errors

  • API:public
  • 首次版本:unreleased
func get_rollback_errors() -> Array[GFSaveRollbackFailure]:

获取回滚失败证据副本。

返回:按回滚顺序记录的类型化失败证据。

get_duration_msec

  • API:public
  • 首次版本:unreleased
func get_duration_msec() -> int:

获取操作耗时。

返回:单调毫秒耗时。

get_metadata

  • API:public
  • 首次版本:unreleased
func get_metadata() -> Dictionary:

获取调用方元数据副本。

返回:调用方定义的临时结果元数据。

结构:

  • return: Dictionary with caller-defined operation metadata.

get_storage_request_ids

  • API:public
  • 首次版本:unreleased
func get_storage_request_ids() -> PackedInt64Array:

获取支撑当前终态的底层 Storage 请求 ID。

返回:按发起顺序排列的请求 ID;没有底层 IO 时为空。

to_dict

  • API:public
  • 首次版本:unreleased
func to_dict() -> Dictionary:

转换为可报告字典。

返回:不包含完整文档载荷的结果摘要。

结构:

  • return: Dictionary with ok, status, operation, profile_id, generation, timing, recovery, error, validation, rollback, and metadata fields.

duplicate_result

  • API:public
  • 首次版本:unreleased
func duplicate_result() -> GFSaveProfileResult:

创建隔离结果副本。

返回:新结果对象。