Class AchievementSyncPlanner
Pure diff engine between an authored achievement set and one platform snapshot: the single policy every sync review window builds its rows from, mirroring the set-algebra shape of AchievementReconciler one layer up, for definitions instead of unlock state.
Inherited Members
Namespace: Serenity.Achievements.Application.Sync
Assembly: Serenity.Achievements.Application.dll
Syntax
public static class AchievementSyncPlanner
Remarks
Determinism is the whole point: two calls with the same content, in any input order, produce
byte-for-byte the same plan, the same discipline
AchievementManifestExporter already
applies to manifest rows. Items come out ordered by ApiName then LocalId, both
ordinal; field changes within an item come out in AchievementSyncFieldKind
declaration order, localized ones then ordered by locale code (ordinal); every locale code this
planner is given is de-duplicated and ordinal-sorted before anything else runs, regardless of the
order the caller happened to build the list in.
Icons are the one field pair this planner treats differently from the "unsupported values that differ are marked, never dropped" rule the rest of the fields follow. A push-only icon that this connector cannot push, or a pulled icon it cannot pull, produces no field change at all rather than an Unsupported one — the icon paragraph of the sync design conditions the comparison itself on capability and direction, not just the label put on its result, because an icon a connector never offers to touch is not a decision an author has anything to make about it. What a pull offers for the icons it can pull is Serenity.Achievements.Application.Sync.AchievementSyncIconPullPlanner's.
ApiName is identity, never a diffed field, and is left out of every plan item's field changes. LocalizationKeyAdoption is not a diffed field either: a pull offers it as one extra reviewable row on a matched achievement that holds literal text, decided by Serenity.Achievements.Application.Sync.AchievementSyncKeyAdoptionPlanner, and only when AchievementSyncPlanOptions says the project can file translations.
Methods
Plan(IReadOnlyList<AchievementSyncRecord>, AchievementStorefrontSnapshot, AchievementSyncCapabilities, AchievementSyncDirection, IReadOnlyList<string>)
Builds the diff between an authored achievement set and one platform snapshot.
Declaration
public static AchievementSyncPlan Plan(IReadOnlyList<AchievementSyncRecord> authored, AchievementStorefrontSnapshot platform, AchievementSyncCapabilities capabilities, AchievementSyncDirection direction, IReadOnlyList<string> localeCodes)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<AchievementSyncRecord> | authored | The achievements this project defines for this storefront. May be null or contain null. |
| AchievementStorefrontSnapshot | platform | The most recent pull from the storefront. May be null. |
| AchievementSyncCapabilities | capabilities | What the connector for this storefront can push, pull and create. |
| AchievementSyncDirection | direction | Which way this plan evaluates change: from Serenity, or from the platform. |
| IReadOnlyList<string> | localeCodes | The locales to diff DisplayName and Description for. May be null. |
Returns
| Type | Description |
|---|---|
| AchievementSyncPlan | The plan, ready for a review window to render or a review selection to accept from. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | When no capabilities were given. |
Plan(IReadOnlyList<AchievementSyncRecord>, AchievementStorefrontSnapshot, AchievementSyncCapabilities, AchievementSyncDirection, IReadOnlyList<string>, AchievementSyncPlanOptions)
Builds the diff, knowing what the project can do with translated text.
Declaration
public static AchievementSyncPlan Plan(IReadOnlyList<AchievementSyncRecord> authored, AchievementStorefrontSnapshot platform, AchievementSyncCapabilities capabilities, AchievementSyncDirection direction, IReadOnlyList<string> localeCodes, AchievementSyncPlanOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<AchievementSyncRecord> | authored | The achievements this project defines for this storefront. May be null or contain null. |
| AchievementStorefrontSnapshot | platform | The most recent pull from the storefront. May be null. |
| AchievementSyncCapabilities | capabilities | What the connector for this storefront can push, pull and create. |
| AchievementSyncDirection | direction | Which way this plan evaluates change: from Serenity, or from the platform. |
| IReadOnlyList<string> | localeCodes | The locales to diff the localized fields for. May be null. |
| AchievementSyncPlanOptions | options | What the project tells the planner about importing translations. May be null. |
Returns
| Type | Description |
|---|---|
| AchievementSyncPlan | The plan, ready for a review window to render or a review selection to accept from. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | When no capabilities were given. |