GFStorageConflictReport¶
API Reference / Standard / 类索引
- 路径:
addons/gf/standard/utilities/storage/gf_storage_conflict_report.gd - 模块:
Standard - 继承:
Resource - API:
public - 类别:值对象 (
value_object) - 首次版本:
3.17.0
存储同步冲突的通用报告数据。 该资源只描述冲突,不决定如何解决冲突。项目可以把它用于云同步、 多端合并、调试 UI 或自动化测试。
成员概览¶
| 类型 | 名称 | 签名 |
|---|---|---|
| 枚举 | Resolution |
enum Resolution |
| 属性 | file_name |
var file_name: String = "" |
| 属性 | key |
var key: String = "" |
| 属性 | local_value |
var local_value: Variant = null |
| 属性 | remote_value |
var remote_value: Variant = null |
| 属性 | resolved_value |
var resolved_value: Variant = null |
| 属性 | resolution |
var resolution: Resolution = Resolution.UNRESOLVED |
| 属性 | metadata |
var metadata: Dictionary = {} |
| 方法 | apply_dict |
func apply_dict(data: Dictionary) -> void: |
| 方法 | to_dict |
func to_dict() -> Dictionary: |
| 方法 | to_json_safe_dict |
func to_json_safe_dict(options: Dictionary = {}) -> Dictionary: |
| 方法 | duplicate_report |
func duplicate_report() -> GFStorageConflictReport: |
| 方法 | is_resolved |
func is_resolved() -> bool: |
| 方法 | from_dict |
static func from_dict(data: Dictionary) -> GFStorageConflictReport: |
枚举¶
Resolution¶
- API:
public
enum Resolution {
## 尚未决定。
UNRESOLVED,
## 使用本地值。
USE_LOCAL,
## 使用远端值。
USE_REMOTE,
## 使用合并后的值。
MERGED,
## 跳过该冲突。
SKIPPED,
}
冲突解决策略。
属性¶
file_name¶
- API:
public
冲突所属逻辑文件名。
key¶
- API:
public
冲突字段或业务 key。
local_value¶
- API:
public
本地值。
结构:
local_value: Variant,从本地记录复制的冲突 key 或载荷值。
remote_value¶
- API:
public
远端值。
结构:
remote_value: Variant,从远端记录复制的冲突 key 或载荷值。
resolved_value¶
- API:
public
合并后的值。
结构:
resolved_value: Variant,由解析器选择或合并出的值。
resolution¶
- API:
public
解决策略。
metadata¶
- API:
public
扩展元数据。
结构:
metadata: Dictionary,包含解析器特定诊断信息或后端元数据快照。
方法¶
apply_dict¶
- API:
public
从字典应用字段。
参数:
| 名称 | 说明 |
|---|---|
data |
输入字典。 |
结构:
data: Dictionary,包含 file_name、key、local_value、remote_value、resolved_value、resolution 和 metadata。
to_dict¶
- API:
public
转换为字典。
返回:字典副本。
结构:
return: Dictionary,包含 file_name、key、local_value、remote_value、resolved_value、resolution 和 metadata。
to_json_safe_dict¶
- API:
public - 首次版本:
8.0.0
转换为可安全 JSON.stringify() 的报告字典。
参数:
| 名称 | 说明 |
|---|---|
options |
传给 GFReportValueCodec 的编码选项。 |
返回:JSON-safe 冲突报告。
结构:
options: Dictionary with GFReportValueCodec options.return: Dictionary,只包含 JSON-compatible values 和正式报告 marker。
duplicate_report¶
- API:
public
复制冲突报告。
返回:新报告实例。
is_resolved¶
- API:
public
是否已经解决。
返回:resolution 不是 UNRESOLVED 时返回 true。
from_dict¶
- API:
public
从字典创建冲突报告。
参数:
| 名称 | 说明 |
|---|---|
data |
输入字典。 |
返回:新报告实例。
结构:
data: Dictionary,包含 file_name、key、local_value、remote_value、resolved_value、resolution 和 metadata。