13d3aeab09
Phase 1b of the v2 entity-model rewrite. The design's live-edit model means
the 12 v2 live-edit entities no longer carry a generation scope — they're
edited directly via AdminOperationsActor, with RowVersion (added in Task 14a)
providing last-write-wins detection.
Entity changes (12 files):
Equipment, DriverInstance, Device, Tag, PollGroup, Namespace,
UnsArea, UnsLine, NodeAcl, Script, VirtualTag, ScriptedAlarm
- Removed: public long GenerationId
- Removed: public ConfigGeneration? Generation (navigation)
DbContext changes (OtOpcUaConfigDbContext.cs):
- Removed 12 HasOne(x => x.Generation).WithMany().HasForeignKey... mappings
- Rewrote ~36 indexes: dropped the GenerationId column from each composite
key, renamed UX_<Table>_Generation_<X> -> UX_<Table>_<X> and
IX_<Table>_Generation_<X> -> IX_<Table>_<X>. Logical IDs become globally
unique (UX_<Table>_LogicalId on the LogicalId column alone).
- Removed Namespace's redundant UX_Namespace_Generation_LogicalId_Cluster
index (subsumed by the new UX_Namespace_LogicalId).
Core.Tests fixtures (4 files):
Removed "GenerationId = 1," lines from:
- PermissionTrieBuilderTests.cs (NodeAcl Row factory)
- PermissionTrieTests.cs (NodeAcl Row factory)
- TriePermissionEvaluatorTests.cs (NodeAcl Row factory + 2 gen{1,5}Row
mutations that test stale-generation evaluation; the trie itself still
carries a generation tag via PermissionTrie.GenerationId, fed in via
PermissionTrieBuilder.Build's generationId parameter, so the tests
still exercise the production code path)
- EquipmentNodeWalkerTests.cs (Area/Line/Eq/Tag/VirtualTag/ScriptedAlarm
builders)
Expected breakage (accepted per Task 56 policy):
src/Server/ZB.MOM.WW.OtOpcUa.Server ~25 errors (DriverInstanceBootstrapper,
AuthorizationBootstrap,
EquipmentNamespaceContentLoader,
Phase7Composer, ...)
src/Server/ZB.MOM.WW.OtOpcUa.Admin ~45 errors (VirtualTags.razor,
ScriptedAlarms.razor,
DriverInstanceService,
EquipmentService,
EquipmentImportBatchService,
UnsService,
FocasDriverDetailService,
...)
Server.Tests, Admin.Tests, Admin.E2ETests also break transitively (they
project-reference Server/Admin). All deleted in Task 56.
Verification:
dotnet build src/Core/ZB.MOM.WW.OtOpcUa.Configuration -> 0 errors
dotnet build tests/Core/ZB.MOM.WW.OtOpcUa.Core.Tests -> 0 errors
dotnet build tests/Core/ZB.MOM.WW.OtOpcUa.Configuration.Tests -> 0 errors
dotnet build (whole solution) -> 70 errors, all in Server/Admin
51 lines
2.2 KiB
C#
51 lines
2.2 KiB
C#
namespace ZB.MOM.WW.OtOpcUa.Configuration.Entities;
|
|
|
|
/// <summary>One driver instance in a cluster's generation. JSON config is schemaless per-driver-type.</summary>
|
|
public sealed class DriverInstance
|
|
{
|
|
public Guid DriverInstanceRowId { get; set; }
|
|
|
|
public required string DriverInstanceId { get; set; }
|
|
|
|
public required string ClusterId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Logical FK to <see cref="Namespace.NamespaceId"/>. Same-cluster binding enforced by
|
|
/// <c>sp_ValidateDraft</c> per decision #122: Namespace.ClusterId must equal DriverInstance.ClusterId.
|
|
/// </summary>
|
|
public required string NamespaceId { get; set; }
|
|
|
|
public required string Name { get; set; }
|
|
|
|
/// <summary>Galaxy | ModbusTcp | AbCip | AbLegacy | S7 | TwinCat | Focas | OpcUaClient</summary>
|
|
public required string DriverType { get; set; }
|
|
|
|
public bool Enabled { get; set; } = true;
|
|
|
|
/// <summary>Schemaless per-driver-type JSON config. Validated against registered JSON schema at draft-publish time (decision #91).</summary>
|
|
public required string DriverConfig { get; set; }
|
|
|
|
/// <summary>
|
|
/// Optional per-instance overrides for the Phase 6.1 shared Polly resilience pipeline.
|
|
/// Null = use the driver's tier defaults (decision #143). When populated, expected shape:
|
|
/// <code>
|
|
/// {
|
|
/// "bulkheadMaxConcurrent": 16,
|
|
/// "bulkheadMaxQueue": 64,
|
|
/// "capabilityPolicies": {
|
|
/// "Read": { "timeoutSeconds": 5, "retryCount": 5, "breakerFailureThreshold": 3 },
|
|
/// "Write": { "timeoutSeconds": 5, "retryCount": 0, "breakerFailureThreshold": 5 }
|
|
/// }
|
|
/// }
|
|
/// </code>
|
|
/// Parsed at startup by <c>DriverResilienceOptionsParser</c>; every key is optional +
|
|
/// unrecognised keys are ignored so future shapes land without a migration.
|
|
/// </summary>
|
|
public string? ResilienceConfig { get; set; }
|
|
|
|
/// <summary>Optimistic concurrency token for last-write-wins detection in the v2 live-edit model.</summary>
|
|
public byte[] RowVersion { get; set; } = Array.Empty<byte>();
|
|
|
|
public ServerCluster? Cluster { get; set; }
|
|
}
|