From fe0a52bc8cb5e90a208c9d2de4fafb1b59b9ae82 Mon Sep 17 00:00:00 2001 From: Roman Ettlinger Date: Wed, 26 Aug 2026 07:07:44 +0200 Subject: [PATCH] Bump OPC UA packages to 2.0.0-preview.2 and migrate the breaking API changes The opcua-preview feed no longer publishes 2.0.158.59919-preview; 2.0.0-preview.2 is now the only version available, so restore fails on any clean machine and CI cannot build. Bump all 43 project files across the 14 OPCFoundation packages. The bump alone is not enough: 2.0.0-preview.2 carries breaking API changes that produce ~21 compile errors in sample code. Migrate each to its documented replacement. - SecurityPolicies is no longer static; it is a sealed class implementing ISecurityPolicyRegistry. The 17 GetDisplayName/GetUri/GetDisplayNames call sites now go through SecurityPolicies.Default, which the API documents as the registry for code with no container in scope - exactly these WinForms dialogs. - The new Opc.Ua.Decimal built-in shadows System.Decimal in files that import Opc.Ua. The affected NumericUpDown bounds now use the decimal keyword. - INodeManager.TransferMonitoredItems gained a MonitoredItemTransferOptions parameter. CustomNodeManager, SampleNodeManager and QuickstartNodeManager get the six-argument overload holding the logic, with the old five-argument form delegating to it - the same shape the SDK's own CustomNodeManager2 uses. The implementation honours DeferInitialValues by skipping SetupResendDataTrigger, which the owning subscription then drives after it commits the transfer. - Session, Subscription and IServerInternal no longer expose DiagnosticsLock, and ISession.SessionDiagnostics is gone. Reads go through ReadDiagnostics, which applies the projection while holding the lock the object owns. The two Server.DiagnosticsLock blocks did not touch the diagnostics summary that lock guarded - they used it as an incidental general lock - so they simply drop it. - ISession.Save/RestoreHistoryContinuationPoint moved to Session.ContinuationPoints.SaveHistory/RestoreHistory, which take and return IHistoryContinuationPoint. HistoryDataReader and the two HistoryReadRequest holders implement that interface and carry their own Id, replacing the separately generated Guid. - NodeBrowser.DataLock is gone: browsers are single-consumer and the base type documents that derived browsers are not expected to synchronize. The six Next() overrides drop the lock. - NodeState.FindChild gained a defaulted assignInstanceNodeIds parameter. Callers are unaffected but overrides must match, so the 23 overrides in the generated model files take it and forward it to base. Verified: all five solutions in the repository build clean in Release, including both solutions CodeQL builds. The configuration work on the parent branch still holds on the new packages - all nine ParseExtension call sites bind, HistoricalAccess still reads ArchiveRoot ".\Archive", and the AlarmCondition encoder still emits WriteEncodeableArray with no ExtensionObject wrapping. Co-Authored-By: Claude Opus 5 --- Samples/Client.Net4/UA Sample Client.csproj | 2 +- .../Common (OLD)/NumericValueEditDlg.cs | 8 +- .../Configuration/SelectProfileCtrl.cs | 2 +- .../Endpoints/ConfiguredServerDlg.cs | 20 +-- .../Endpoints/ConfiguredServerListCtrl.cs | 2 +- .../UA Client Controls.csproj | 8 +- .../Common/PerformanceTestDlg.cs | 2 +- .../Sessions/SecuritySettingsDlg.cs | 6 +- .../Subscriptions/DataChangeFilterEditDlg.cs | 4 +- .../Controls.Net4/UA Sample Controls.csproj | 4 +- .../GDS/Client/GlobalDiscoveryClient.csproj | 4 +- .../Controls/DiscoveryControl.cs | 2 +- .../GlobalDiscoveryClientControls.csproj | 4 +- .../NetCoreGlobalDiscoveryServer.csproj | 6 +- Samples/GDS/ConsoleServer/Program.cs | 25 ++-- .../GDS/Server/GlobalDiscoveryServer.csproj | 6 +- Samples/LDS/ConsoleServer/ConsoleLds.csproj | 2 +- .../Opc.Ua.Sample/Base/CustomNodeManager.cs | 28 ++++- .../Opc.Ua.Sample/Base/SampleNodeManager.cs | 28 ++++- .../MemoryBuffer/MemoryBufferBrowser.cs | 67 +++++----- Samples/Opc.Ua.Sample/Opc.Ua.Sample.csproj | 6 +- .../TestData/HistoryDataReader.cs | 2 +- .../TestData/TestDataNodeManager.cs | 4 +- .../ReferenceClient/Reference Client.csproj | 8 +- .../ReferenceServer/Reference Server.csproj | 6 +- Samples/Server.Net4/ServerDiagnosticsCtrl.cs | 36 +++--- Samples/Server.Net4/UA Sample Server.csproj | 2 +- .../ServerDiagnosticsCtrl.cs | 41 +++--- .../UA Server Controls.csproj | 6 +- .../Client/Aggregation Client.csproj | 2 +- .../ConsoleAggregationServer.csproj | 16 +-- .../ConsoleAggregationServer/Program.cs | 25 ++-- .../Server/Aggregation Server.csproj | 10 +- .../Server/AggregationNodeManager.cs | 51 ++++---- Workshop/Aggregation/Server/Browser.cs | 7 +- .../Client/AlarmCondition Client.csproj | 2 +- .../Server/AlarmCondition Server.csproj | 4 +- Workshop/Boiler/Client/Boiler Client.csproj | 2 +- Workshop/Boiler/Server/Boiler Server.csproj | 2 +- .../Server/Quickstarts.Boiler.Classes.cs | 40 +++--- Workshop/Common/Quickstart Library.csproj | 2 +- Workshop/Common/QuickstartNodeManager.cs | 28 ++++- .../Client/DataAccess Client.csproj | 2 +- .../Server/DataAccess Server.csproj | 2 +- .../DataAccess/Server/Model/SegmentBrowser.cs | 97 +++++++------- .../DataTypes/Client/DataTypes Client.csproj | 2 +- .../DataTypes/Common/DataTypes Library.csproj | 2 +- .../Quickstarts.DataTypes.Types.Classes.cs | 5 +- .../DataTypes/Server/DataTypes Server.csproj | 2 +- Workshop/Empty/Client/Empty Client.csproj | 2 +- Workshop/Empty/Server/Empty Server.csproj | 2 +- .../Client/HistoricalAccess Client.csproj | 2 +- .../Server/HistoricalAccess Server.csproj | 2 +- .../Server/HistoricalAccessNodeManager.cs | 36 +++--- .../Server/Model/SegmentBrowser.cs | 99 ++++++++------- .../UnderlyingSystem/ArchiveFolderBrowser.cs | 119 +++++++++--------- .../Tester/Aggregate Tester.csproj | 4 +- .../Client/HistoricalEvents Client.csproj | 2 +- .../Quickstarts.HistoricalEvents.Classes.cs | 15 ++- .../Server/HistoricalEvents Server.csproj | 2 +- .../Server/HistoricalEventsNodeManager.cs | 15 ++- .../Quickstarts.HistoricalEvents.Classes.cs | 15 ++- Workshop/Methods/Client/Methods Client.csproj | 2 +- Workshop/Methods/Server/Methods Server.csproj | 2 +- .../PerfTest/Client/PerfTest Client.csproj | 2 +- .../PerfTest/Server/MemoryRegisterState.cs | 63 +++++----- .../PerfTest/Server/PerfTest Server.csproj | 2 +- .../Quickstarts.SimpleEvents.Classes.cs | 15 ++- .../Client/SimpleEvents Client.csproj | 2 +- .../Quickstarts.SimpleEvents.Classes.cs | 15 ++- .../Server/SimpleEvents Server.csproj | 2 +- .../Client/UserAuthentication Client.csproj | 2 +- .../Server/UserAuthentication Server.csproj | 4 +- Workshop/Views/Client/Views Client.csproj | 2 +- .../Server/Model/Quickstarts.Views.Classes.cs | 10 +- Workshop/Views/Server/Views Server.csproj | 4 +- 76 files changed, 594 insertions(+), 492 deletions(-) diff --git a/Samples/Client.Net4/UA Sample Client.csproj b/Samples/Client.Net4/UA Sample Client.csproj index 9358bad22..c8877628a 100644 --- a/Samples/Client.Net4/UA Sample Client.csproj +++ b/Samples/Client.Net4/UA Sample Client.csproj @@ -40,7 +40,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Samples/ClientControls.Net4/Configuration/Common (OLD)/NumericValueEditDlg.cs b/Samples/ClientControls.Net4/Configuration/Common (OLD)/NumericValueEditDlg.cs index 0bc77ec2b..f04342891 100644 --- a/Samples/ClientControls.Net4/Configuration/Common (OLD)/NumericValueEditDlg.cs +++ b/Samples/ClientControls.Net4/Configuration/Common (OLD)/NumericValueEditDlg.cs @@ -147,15 +147,15 @@ private void SetLimits(Type type) if (type == typeof(float)) { - ValueCTRL.Minimum = Decimal.MinValue; - ValueCTRL.Maximum = Decimal.MaxValue; + ValueCTRL.Minimum = decimal.MinValue; + ValueCTRL.Maximum = decimal.MaxValue; ValueCTRL.DecimalPlaces = 6; } if (type == typeof(double)) { - ValueCTRL.Minimum = Decimal.MinValue; - ValueCTRL.Maximum = Decimal.MaxValue; + ValueCTRL.Minimum = decimal.MinValue; + ValueCTRL.Maximum = decimal.MaxValue; ValueCTRL.DecimalPlaces = 15; } } diff --git a/Samples/ClientControls.Net4/Configuration/SelectProfileCtrl.cs b/Samples/ClientControls.Net4/Configuration/SelectProfileCtrl.cs index 5fb5c80d8..bfedc5000 100644 --- a/Samples/ClientControls.Net4/Configuration/SelectProfileCtrl.cs +++ b/Samples/ClientControls.Net4/Configuration/SelectProfileCtrl.cs @@ -90,7 +90,7 @@ public Opc.Ua.Security.ListOfSecurityProfiles Profiles builder.Append(", "); } - builder.Append(SecurityPolicies.GetDisplayName(value[ii].ProfileUri)); + builder.Append(SecurityPolicies.Default.GetDisplayName(value[ii].ProfileUri)); } } } diff --git a/Samples/ClientControls.Net4/Endpoints/ConfiguredServerDlg.cs b/Samples/ClientControls.Net4/Endpoints/ConfiguredServerDlg.cs index e8dd4fc41..8eb7c15cd 100644 --- a/Samples/ClientControls.Net4/Endpoints/ConfiguredServerDlg.cs +++ b/Samples/ClientControls.Net4/Endpoints/ConfiguredServerDlg.cs @@ -209,7 +209,7 @@ public EndpointDescriptionString(EndpointDescription endpointDescription) { m_endpointDescription = endpointDescription; m_protocol = new Protocol(endpointDescription); - m_currentPolicy = SecurityPolicies.GetDisplayName(endpointDescription.SecurityPolicyUri); + m_currentPolicy = SecurityPolicies.Default.GetDisplayName(endpointDescription.SecurityPolicyUri); m_messageSecurityMode = endpointDescription.SecurityMode; switch (m_endpointDescription.EncodingSupport) @@ -280,7 +280,7 @@ private void BuildEndpointDescription() { m_stringRepresentation = m_protocol.ToString() + " - "; m_stringRepresentation += m_endpointDescription.SecurityMode + " - "; - m_stringRepresentation += SecurityPolicies.GetDisplayName(m_endpointDescription.SecurityPolicyUri) + " - "; + m_stringRepresentation += SecurityPolicies.Default.GetDisplayName(m_endpointDescription.SecurityPolicyUri) + " - "; switch (m_endpointDescription.EncodingSupport) { @@ -585,7 +585,7 @@ private EndpointDescription FindBestEndpointDescription(List endpoints) // set all available security policies. if (m_showAllOptions) { - SecurityPolicyCB.Items.AddRange(SecurityPolicies.GetDisplayNames()); + SecurityPolicyCB.Items.AddRange(SecurityPolicies.Default.GetDisplayNames()); } // find all unique security policies. @@ -899,7 +899,7 @@ private void InitializeSecurityPolicies(List endpoints) continue; } - string policyName = SecurityPolicies.GetDisplayName(endpoint.SecurityPolicyUri); + string policyName = SecurityPolicies.Default.GetDisplayName(endpoint.SecurityPolicyUri); if (policyName != null) { @@ -918,7 +918,7 @@ private void InitializeSecurityPolicies(List endpoints) // add at least one policy. if (SecurityPolicyCB.Items.Count == 0) { - SecurityPolicyCB.Items.Add(SecurityPolicies.GetDisplayName(SecurityPolicies.None)); + SecurityPolicyCB.Items.Add(SecurityPolicies.Default.GetDisplayName(SecurityPolicies.None)); } // set the current value. @@ -955,13 +955,13 @@ private void InitializeEncodings(List endpoints, EndpointDe if (endpoint != null) { Protocol protocol = new Protocol(endpoint); - String securityPolicy = SecurityPolicies.GetDisplayName(endpoint.SecurityPolicyUri); + String securityPolicy = SecurityPolicies.Default.GetDisplayName(endpoint.SecurityPolicyUri); foreach (EndpointDescription endpointDescription in endpoints) { if ((protocol.Matches(Utils.ParseUri(endpointDescription.EndpointUrl))) && (endpoint.SecurityMode == endpointDescription.SecurityMode) && - (securityPolicy == SecurityPolicies.GetDisplayName(endpointDescription.SecurityPolicyUri))) + (securityPolicy == SecurityPolicies.Default.GetDisplayName(endpointDescription.SecurityPolicyUri))) { switch (endpointDescription.EncodingSupport) { @@ -1355,7 +1355,7 @@ private EndpointDescription CreateDescriptionFromSelections() endpoint = new EndpointDescription(); endpoint.EndpointUrl = builder.ToString(); endpoint.SecurityMode = (MessageSecurityMode)SecurityModeCB.SelectedItem; - endpoint.SecurityPolicyUri = SecurityPolicies.GetUri((string)SecurityPolicyCB.SelectedItem); + endpoint.SecurityPolicyUri = SecurityPolicies.Default.GetUri((string)SecurityPolicyCB.SelectedItem); endpoint.Server.ApplicationName = new LocalizedText(endpoint.EndpointUrl); endpoint.Server.ApplicationType = ApplicationType.Server; endpoint.Server.ApplicationUri = endpoint.EndpointUrl; @@ -1791,7 +1791,7 @@ private void UpdateStatus() { m_statusObject.SetStatus(StatusChannel.SecurityPolicyUri, "Error: Security Policy URI is missing.", StatusType.Warning); } - else if (string.IsNullOrEmpty(SecurityPolicies.GetDisplayName(m_currentDescription.SecurityPolicyUri))) + else if (string.IsNullOrEmpty(SecurityPolicies.Default.GetDisplayName(m_currentDescription.SecurityPolicyUri))) { m_statusObject.SetStatus(StatusChannel.SecurityPolicyUri, "Error: Security Policy URI is invalid.", StatusType.Warning); } diff --git a/Samples/ClientControls.Net4/Endpoints/ConfiguredServerListCtrl.cs b/Samples/ClientControls.Net4/Endpoints/ConfiguredServerListCtrl.cs index fbf9df206..c38ed77bc 100644 --- a/Samples/ClientControls.Net4/Endpoints/ConfiguredServerListCtrl.cs +++ b/Samples/ClientControls.Net4/Endpoints/ConfiguredServerListCtrl.cs @@ -152,7 +152,7 @@ protected override async Task UpdateItemAsync(ListViewItem listItem, object item listItem.SubItems[3].Text = String.Format( "{0}/{1}", - SecurityPolicies.GetDisplayName(endpoint.Description.SecurityPolicyUri), + SecurityPolicies.Default.GetDisplayName(endpoint.Description.SecurityPolicyUri), endpoint.Description.SecurityMode); listItem.SubItems[4].Text = ""; diff --git a/Samples/ClientControls.Net4/UA Client Controls.csproj b/Samples/ClientControls.Net4/UA Client Controls.csproj index c1684f7e6..d3133fe03 100644 --- a/Samples/ClientControls.Net4/UA Client Controls.csproj +++ b/Samples/ClientControls.Net4/UA Client Controls.csproj @@ -185,16 +185,16 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 - 2.0.158.59919-preview + 2.0.0-preview.2 - 2.0.158.59919-preview + 2.0.0-preview.2 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Samples/Controls.Net4/Common/PerformanceTestDlg.cs b/Samples/Controls.Net4/Common/PerformanceTestDlg.cs index eae351d94..2bc4c1b98 100644 --- a/Samples/Controls.Net4/Common/PerformanceTestDlg.cs +++ b/Samples/Controls.Net4/Common/PerformanceTestDlg.cs @@ -159,7 +159,7 @@ private void SaveResults(string filePath) writer.Write("{0}", uri); writer.Write(",{0}", uri.Scheme); writer.Write(",{0}", endpoint.SecurityMode); - writer.Write(",{0}", SecurityPolicies.GetDisplayName(endpoint.SecurityPolicyUri)); + writer.Write(",{0}", SecurityPolicies.Default.GetDisplayName(endpoint.SecurityPolicyUri)); writer.Write(",{0}", (results[ii].Endpoint.Configuration.UseBinaryEncoding) ? "Binary" : "XML"); foreach (KeyValuePair result in results[ii].Results) diff --git a/Samples/Controls.Net4/Sessions/SecuritySettingsDlg.cs b/Samples/Controls.Net4/Sessions/SecuritySettingsDlg.cs index 147c63e41..0a3dce26a 100644 --- a/Samples/Controls.Net4/Sessions/SecuritySettingsDlg.cs +++ b/Samples/Controls.Net4/Sessions/SecuritySettingsDlg.cs @@ -57,7 +57,7 @@ public SecuritySettingsDlg() SecurityModeCB.Items.Add(value); } - SecurityPolicyUriCB.Items.AddRange(SecurityPolicies.GetDisplayNames()); + SecurityPolicyUriCB.Items.AddRange(SecurityPolicies.Default.GetDisplayNames()); } /// @@ -78,7 +78,7 @@ public bool ShowDialog(ITelemetryContext telemetry, ref MessageSecurityMode secu if (!String.IsNullOrEmpty(securityPolicyUri)) { - SecurityPolicyUriCB.SelectedItem = SecurityPolicies.GetDisplayName(securityPolicyUri); + SecurityPolicyUriCB.SelectedItem = SecurityPolicies.Default.GetDisplayName(securityPolicyUri); } // show dialog. @@ -88,7 +88,7 @@ public bool ShowDialog(ITelemetryContext telemetry, ref MessageSecurityMode secu } securityMode = (MessageSecurityMode)SecurityModeCB.SelectedItem; - securityPolicyUri = SecurityPolicies.GetUri((string)SecurityPolicyUriCB.SelectedItem); + securityPolicyUri = SecurityPolicies.Default.GetUri((string)SecurityPolicyUriCB.SelectedItem); useNativeStack = UseNativeStackCK.Checked; return true; diff --git a/Samples/Controls.Net4/Subscriptions/DataChangeFilterEditDlg.cs b/Samples/Controls.Net4/Subscriptions/DataChangeFilterEditDlg.cs index 9eca4c4ca..ac0b2215d 100644 --- a/Samples/Controls.Net4/Subscriptions/DataChangeFilterEditDlg.cs +++ b/Samples/Controls.Net4/Subscriptions/DataChangeFilterEditDlg.cs @@ -117,8 +117,8 @@ private void DeadbandTypeCB_SelectedIndexChanged(object sender, EventArgs e) } else { - DeadbandNC.Minimum = Decimal.MinValue; - DeadbandNC.Maximum = Decimal.MaxValue; + DeadbandNC.Minimum = decimal.MinValue; + DeadbandNC.Maximum = decimal.MaxValue; } } } diff --git a/Samples/Controls.Net4/UA Sample Controls.csproj b/Samples/Controls.Net4/UA Sample Controls.csproj index df79236eb..300507ba6 100644 --- a/Samples/Controls.Net4/UA Sample Controls.csproj +++ b/Samples/Controls.Net4/UA Sample Controls.csproj @@ -104,10 +104,10 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Samples/GDS/Client/GlobalDiscoveryClient.csproj b/Samples/GDS/Client/GlobalDiscoveryClient.csproj index 3c302f117..ce6540c21 100644 --- a/Samples/GDS/Client/GlobalDiscoveryClient.csproj +++ b/Samples/GDS/Client/GlobalDiscoveryClient.csproj @@ -50,10 +50,10 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Samples/GDS/ClientControls/Controls/DiscoveryControl.cs b/Samples/GDS/ClientControls/Controls/DiscoveryControl.cs index d473473e2..e914c68c7 100644 --- a/Samples/GDS/ClientControls/Controls/DiscoveryControl.cs +++ b/Samples/GDS/ClientControls/Controls/DiscoveryControl.cs @@ -611,7 +611,7 @@ private void ShowEndpointDescriptions(List endpoints) row[0] = endpoint.EndpointUrl; row[1] = endpoint.SecurityMode.ToString(); - row[2] = SecurityPolicies.GetDisplayName(endpoint.SecurityPolicyUri); + row[2] = SecurityPolicies.Default.GetDisplayName(endpoint.SecurityPolicyUri); row[3] = endpoint; EndpointsTable.Rows.Add(row); diff --git a/Samples/GDS/ClientControls/GlobalDiscoveryClientControls.csproj b/Samples/GDS/ClientControls/GlobalDiscoveryClientControls.csproj index a139aa620..303ae8c34 100644 --- a/Samples/GDS/ClientControls/GlobalDiscoveryClientControls.csproj +++ b/Samples/GDS/ClientControls/GlobalDiscoveryClientControls.csproj @@ -30,10 +30,10 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Samples/GDS/ConsoleServer/NetCoreGlobalDiscoveryServer.csproj b/Samples/GDS/ConsoleServer/NetCoreGlobalDiscoveryServer.csproj index 68f694802..2c0637c7c 100644 --- a/Samples/GDS/ConsoleServer/NetCoreGlobalDiscoveryServer.csproj +++ b/Samples/GDS/ConsoleServer/NetCoreGlobalDiscoveryServer.csproj @@ -20,9 +20,9 @@ - - - + + + diff --git a/Samples/GDS/ConsoleServer/Program.cs b/Samples/GDS/ConsoleServer/Program.cs index d893fc9ea..d5fef01bd 100644 --- a/Samples/GDS/ConsoleServer/Program.cs +++ b/Samples/GDS/ConsoleServer/Program.cs @@ -531,23 +531,22 @@ private void EventStatus(ISession session, SessionEventReason reason) private void PrintSessionStatus(ISession session, string reason, bool lastContact = false) { - lock (session.DiagnosticsLock) + // The session owns its diagnostics lock and no longer exposes it; + // ReadDiagnostics applies each projection while holding that lock. + string item = Utils.Format("{0,9}:{1,20}:", reason, session.ReadDiagnostics(d => d.SessionName)); + if (lastContact) { - string item = Utils.Format("{0,9}:{1,20}:", reason, session.SessionDiagnostics.SessionName); - if (lastContact) - { - item += Utils.Format("Last Event:{0:HH:mm:ss}", session.SessionDiagnostics.ClientLastContactTime.ToLocalTime()); - } - else + item += Utils.Format("Last Event:{0:HH:mm:ss}", session.ReadDiagnostics(d => d.ClientLastContactTime).ToLocalTime()); + } + else + { + if (session.Identity != null) { - if (session.Identity != null) - { - item += Utils.Format(":{0,20}", session.Identity.DisplayName); - } - item += Utils.Format(":{0}", session.Id); + item += Utils.Format(":{0,20}", session.Identity.DisplayName); } - Console.WriteLine(item); + item += Utils.Format(":{0}", session.Id); } + Console.WriteLine(item); } private async void StatusThreadAsync() diff --git a/Samples/GDS/Server/GlobalDiscoveryServer.csproj b/Samples/GDS/Server/GlobalDiscoveryServer.csproj index dd886e0c9..6b5532a35 100644 --- a/Samples/GDS/Server/GlobalDiscoveryServer.csproj +++ b/Samples/GDS/Server/GlobalDiscoveryServer.csproj @@ -40,13 +40,13 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 - 2.0.158.59919-preview + 2.0.0-preview.2 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Samples/LDS/ConsoleServer/ConsoleLds.csproj b/Samples/LDS/ConsoleServer/ConsoleLds.csproj index 0a140ecd3..a57ebd05b 100644 --- a/Samples/LDS/ConsoleServer/ConsoleLds.csproj +++ b/Samples/LDS/ConsoleServer/ConsoleLds.csproj @@ -10,7 +10,7 @@ - + diff --git a/Samples/Opc.Ua.Sample/Base/CustomNodeManager.cs b/Samples/Opc.Ua.Sample/Base/CustomNodeManager.cs index c3a16f537..283a6d1e8 100644 --- a/Samples/Opc.Ua.Sample/Base/CustomNodeManager.cs +++ b/Samples/Opc.Ua.Sample/Base/CustomNodeManager.cs @@ -2935,6 +2935,32 @@ public virtual void TransferMonitoredItems( IList monitoredItems, IList processedItems, IList errors) + { + TransferMonitoredItems( + context, + sendInitialValues, + monitoredItems, + processedItems, + errors, + new MonitoredItemTransferOptions()); + } + + /// + /// Transfers a set of monitored items. + /// + /// The context. + /// Whether the subscription should send initial values after transfer. + /// The set of monitoring items to update. + /// The list of bool with items that were already processed. + /// Any errors. + /// Controls how the transfer is executed. + public virtual void TransferMonitoredItems( + OperationContext context, + bool sendInitialValues, + IList monitoredItems, + IList processedItems, + IList errors, + MonitoredItemTransferOptions transferOptions) { ServerSystemContext systemContext = m_systemContext.Copy(context); IList transferredItems = new List(); @@ -2964,7 +2990,7 @@ public virtual void TransferMonitoredItems( // owned by this node manager. processedItems[ii] = true; transferredItems.Add(monitoredItems[ii]); - if (sendInitialValues) + if (sendInitialValues && !transferOptions.DeferInitialValues) { monitoredItems[ii].SetupResendDataTrigger(); } diff --git a/Samples/Opc.Ua.Sample/Base/SampleNodeManager.cs b/Samples/Opc.Ua.Sample/Base/SampleNodeManager.cs index cf18c6302..310b00a9b 100644 --- a/Samples/Opc.Ua.Sample/Base/SampleNodeManager.cs +++ b/Samples/Opc.Ua.Sample/Base/SampleNodeManager.cs @@ -2956,6 +2956,32 @@ public virtual void TransferMonitoredItems( IList monitoredItems, IList processedItems, IList errors) + { + TransferMonitoredItems( + context, + sendInitialValues, + monitoredItems, + processedItems, + errors, + new MonitoredItemTransferOptions()); + } + + /// + /// Transfers a set of monitored items. + /// + /// The context. + /// Whether the subscription should send initial values after transfer. + /// The set of monitoring items to update. + /// The list of bool with items that were already processed. + /// Any errors. + /// Controls how the transfer is executed. + public virtual void TransferMonitoredItems( + OperationContext context, + bool sendInitialValues, + IList monitoredItems, + IList processedItems, + IList errors, + MonitoredItemTransferOptions transferOptions) { ServerSystemContext systemContext = m_systemContext.Copy(context); IList transferredItems = new List(); @@ -2982,7 +3008,7 @@ public virtual void TransferMonitoredItems( processedItems[ii] = true; transferredItems.Add(monitoredItems[ii]); - if (sendInitialValues) + if (sendInitialValues && !transferOptions.DeferInitialValues) { monitoredItems[ii].SetupResendDataTrigger(); } diff --git a/Samples/Opc.Ua.Sample/MemoryBuffer/MemoryBufferBrowser.cs b/Samples/Opc.Ua.Sample/MemoryBuffer/MemoryBufferBrowser.cs index 1e103b397..ebe17bc4c 100644 --- a/Samples/Opc.Ua.Sample/MemoryBuffer/MemoryBufferBrowser.cs +++ b/Samples/Opc.Ua.Sample/MemoryBuffer/MemoryBufferBrowser.cs @@ -80,51 +80,50 @@ public MemoryBufferBrowser( /// public override IReference Next() { - lock (DataLock) - { - IReference reference = null; + // NodeBrowser instances are single-consumer and perform no + // synchronization of their own; the former DataLock is gone. + IReference reference = null; - // enumerate pre-defined references. - // always call first to ensure any pushed-back references are returned first. - reference = base.Next(); + // enumerate pre-defined references. + // always call first to ensure any pushed-back references are returned first. + reference = base.Next(); - if (reference != null) - { - return reference; - } + if (reference != null) + { + return reference; + } - if (m_stage == Stage.Begin) - { - m_stage = Stage.Components; - m_position = 0; - } + if (m_stage == Stage.Begin) + { + m_stage = Stage.Components; + m_position = 0; + } - // don't start browsing huge number of references when only internal references are requested. - if (InternalOnly) - { - return null; - } + // don't start browsing huge number of references when only internal references are requested. + if (InternalOnly) + { + return null; + } - // enumerate components. - if (m_stage == Stage.Components) + // enumerate components. + if (m_stage == Stage.Components) + { + if (IsRequired(ReferenceTypeIds.HasComponent, false)) { - if (IsRequired(ReferenceTypeIds.HasComponent, false)) - { - reference = NextChild(); + reference = NextChild(); - if (reference != null) - { - return reference; - } + if (reference != null) + { + return reference; } - - m_stage = Stage.ModelParents; - m_position = 0; } - // all done. - return null; + m_stage = Stage.ModelParents; + m_position = 0; } + + // all done. + return null; } #endregion diff --git a/Samples/Opc.Ua.Sample/Opc.Ua.Sample.csproj b/Samples/Opc.Ua.Sample/Opc.Ua.Sample.csproj index abac44a99..34782cc4c 100644 --- a/Samples/Opc.Ua.Sample/Opc.Ua.Sample.csproj +++ b/Samples/Opc.Ua.Sample/Opc.Ua.Sample.csproj @@ -32,9 +32,9 @@ - - - + + + diff --git a/Samples/Opc.Ua.Sample/TestData/HistoryDataReader.cs b/Samples/Opc.Ua.Sample/TestData/HistoryDataReader.cs index 38621ab77..e68ade1dd 100644 --- a/Samples/Opc.Ua.Sample/TestData/HistoryDataReader.cs +++ b/Samples/Opc.Ua.Sample/TestData/HistoryDataReader.cs @@ -43,7 +43,7 @@ namespace TestData /// /// A class used to read values from a history data source. /// - public class HistoryDataReader : IDisposable + public class HistoryDataReader : IHistoryContinuationPoint { #region Constructors /// diff --git a/Samples/Opc.Ua.Sample/TestData/TestDataNodeManager.cs b/Samples/Opc.Ua.Sample/TestData/TestDataNodeManager.cs index bee13a7da..8a54e5fcb 100644 --- a/Samples/Opc.Ua.Sample/TestData/TestDataNodeManager.cs +++ b/Samples/Opc.Ua.Sample/TestData/TestDataNodeManager.cs @@ -436,7 +436,7 @@ protected virtual HistoryDataReader RestoreDataReader(Opc.Ua.Server.ServerSystem return null; } - HistoryDataReader reader = context.OperationContext.Session.RestoreHistoryContinuationPoint(continuationPoint.ToByteString()) as HistoryDataReader; + HistoryDataReader reader = context.OperationContext.Session.ContinuationPoints.RestoreHistory(continuationPoint.ToByteString()) as HistoryDataReader; if (reader == null) { @@ -456,7 +456,7 @@ protected virtual void SaveDataReader(Opc.Ua.Server.ServerSystemContext context, return; } - context.OperationContext.Session.SaveHistoryContinuationPoint(reader.Id, reader); + context.OperationContext.Session.ContinuationPoints.SaveHistory(reader); } /// diff --git a/Samples/ReferenceClient/Reference Client.csproj b/Samples/ReferenceClient/Reference Client.csproj index 15c88e48d..e143cdcf6 100644 --- a/Samples/ReferenceClient/Reference Client.csproj +++ b/Samples/ReferenceClient/Reference Client.csproj @@ -26,16 +26,16 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 - 2.0.158.59919-preview + 2.0.0-preview.2 - 2.0.158.59919-preview + 2.0.0-preview.2 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Samples/ReferenceServer/Reference Server.csproj b/Samples/ReferenceServer/Reference Server.csproj index fba92751e..b364bada4 100644 --- a/Samples/ReferenceServer/Reference Server.csproj +++ b/Samples/ReferenceServer/Reference Server.csproj @@ -30,13 +30,13 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 - 2.0.158.59919-preview + 2.0.0-preview.2 - 2.0.158.59919-preview + 2.0.0-preview.2 4.4.0 diff --git a/Samples/Server.Net4/ServerDiagnosticsCtrl.cs b/Samples/Server.Net4/ServerDiagnosticsCtrl.cs index e00bd1fb8..27407ea91 100644 --- a/Samples/Server.Net4/ServerDiagnosticsCtrl.cs +++ b/Samples/Server.Net4/ServerDiagnosticsCtrl.cs @@ -103,24 +103,23 @@ private void UpdateSessions() { ISession session = sessions[ii]; - lock (session.DiagnosticsLock) - { - ListViewItem item = new ListViewItem(session.SessionDiagnostics.SessionName); + // The session owns its diagnostics lock and no longer exposes it; + // ReadDiagnostics applies each projection while holding that lock. + ListViewItem item = new ListViewItem(session.ReadDiagnostics(d => d.SessionName)); - if (session.Identity != null) - { - item.SubItems.Add(session.Identity.DisplayName); - } - else - { - item.SubItems.Add(String.Empty); - } + if (session.Identity != null) + { + item.SubItems.Add(session.Identity.DisplayName); + } + else + { + item.SubItems.Add(String.Empty); + } - item.SubItems.Add(String.Format("{0}", session.Id)); - item.SubItems.Add(String.Format("{0:HH:mm:ss}", session.SessionDiagnostics.ClientLastContactTime.ToLocalTime())); + item.SubItems.Add(String.Format("{0}", session.Id)); + item.SubItems.Add(String.Format("{0:HH:mm:ss}", session.ReadDiagnostics(d => d.ClientLastContactTime).ToLocalTime())); - SessionsLV.Items.Add(item); - } + SessionsLV.Items.Add(item); } // adjust @@ -148,10 +147,9 @@ private void UpdateSubscriptions() item.SubItems.Add(String.Format("{0}", (int)subscription.PublishingInterval)); item.SubItems.Add(String.Format("{0}", subscription.MonitoredItemCount)); - lock (subscription.DiagnosticsLock) - { - item.SubItems.Add(String.Format("{0}", subscription.Diagnostics.NextSequenceNumber)); - } + // Same as above: the subscription reads its own diagnostics under the + // lock it owns, replacing the former DiagnosticsLock property. + item.SubItems.Add(String.Format("{0}", subscription.ReadDiagnostics(d => d.NextSequenceNumber))); SubscriptionsLV.Items.Add(item); } diff --git a/Samples/Server.Net4/UA Sample Server.csproj b/Samples/Server.Net4/UA Sample Server.csproj index b2eb0c161..8ff6bec0a 100644 --- a/Samples/Server.Net4/UA Sample Server.csproj +++ b/Samples/Server.Net4/UA Sample Server.csproj @@ -39,7 +39,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Samples/ServerControls.Net4/ServerDiagnosticsCtrl.cs b/Samples/ServerControls.Net4/ServerDiagnosticsCtrl.cs index f395c45e6..76db4f630 100644 --- a/Samples/ServerControls.Net4/ServerDiagnosticsCtrl.cs +++ b/Samples/ServerControls.Net4/ServerDiagnosticsCtrl.cs @@ -102,24 +102,27 @@ private void UpdateSessions() { ISession session = sessions[ii]; - lock (session.DiagnosticsLock) - { - ListViewItem item = new ListViewItem(session.SessionDiagnostics.SessionName); - - if (session.Identity != null) - { - item.SubItems.Add(session.Identity.DisplayName); - } - else - { - item.SubItems.Add(String.Empty); - } + // The session owns its diagnostics lock and no longer exposes it. + // ReadDiagnostics applies the projection while holding that lock; + // the diagnostics object must not escape the callback. + string sessionName = session.ReadDiagnostics(d => d.SessionName); + DateTimeUtc lastContactTime = session.ReadDiagnostics(d => d.ClientLastContactTime); - item.SubItems.Add(String.Format("{0}", session.Id)); - item.SubItems.Add(String.Format("{0:HH:mm:ss}", session.SessionDiagnostics.ClientLastContactTime.ToLocalTime())); + ListViewItem item = new ListViewItem(sessionName); - SessionsLV.Items.Add(item); + if (session.Identity != null) + { + item.SubItems.Add(session.Identity.DisplayName); + } + else + { + item.SubItems.Add(String.Empty); } + + item.SubItems.Add(String.Format("{0}", session.Id)); + item.SubItems.Add(String.Format("{0:HH:mm:ss}", lastContactTime.ToLocalTime())); + + SessionsLV.Items.Add(item); } // adjust @@ -147,10 +150,10 @@ private void UpdateSubscriptions() item.SubItems.Add(String.Format("{0}", (int)subscription.PublishingInterval)); item.SubItems.Add(String.Format("{0}", subscription.MonitoredItemCount)); - lock (subscription.DiagnosticsLock) - { - item.SubItems.Add(String.Format("{0}", subscription.Diagnostics.NextSequenceNumber)); - } + // Same as above: the subscription reads its own diagnostics under + // the lock it owns, replacing the former DiagnosticsLock property. + item.SubItems.Add(String.Format("{0}", + subscription.ReadDiagnostics(d => d.NextSequenceNumber))); SubscriptionsLV.Items.Add(item); } diff --git a/Samples/ServerControls.Net4/UA Server Controls.csproj b/Samples/ServerControls.Net4/UA Server Controls.csproj index 3fcb74839..ceda15505 100644 --- a/Samples/ServerControls.Net4/UA Server Controls.csproj +++ b/Samples/ServerControls.Net4/UA Server Controls.csproj @@ -38,13 +38,13 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 - 2.0.158.59919-preview + 2.0.0-preview.2 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Workshop/Aggregation/Client/Aggregation Client.csproj b/Workshop/Aggregation/Client/Aggregation Client.csproj index f75979c8e..a2cfd9946 100644 --- a/Workshop/Aggregation/Client/Aggregation Client.csproj +++ b/Workshop/Aggregation/Client/Aggregation Client.csproj @@ -31,7 +31,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Workshop/Aggregation/ConsoleAggregationServer/ConsoleAggregationServer.csproj b/Workshop/Aggregation/ConsoleAggregationServer/ConsoleAggregationServer.csproj index 6695e1d55..f9a2a8a09 100644 --- a/Workshop/Aggregation/ConsoleAggregationServer/ConsoleAggregationServer.csproj +++ b/Workshop/Aggregation/ConsoleAggregationServer/ConsoleAggregationServer.csproj @@ -46,18 +46,18 @@ - - - - + + + + - - - - + + + + diff --git a/Workshop/Aggregation/ConsoleAggregationServer/Program.cs b/Workshop/Aggregation/ConsoleAggregationServer/Program.cs index 03295a387..70947a8ff 100644 --- a/Workshop/Aggregation/ConsoleAggregationServer/Program.cs +++ b/Workshop/Aggregation/ConsoleAggregationServer/Program.cs @@ -238,23 +238,22 @@ private void EventStatus(ISession session, SessionEventReason reason) private void PrintSessionStatus(ISession session, string reason, bool lastContact = false) { - lock (session.DiagnosticsLock) + // The session owns its diagnostics lock and no longer exposes it; + // ReadDiagnostics applies each projection while holding that lock. + string item = String.Format("{0,9}:{1,20}:", reason, session.ReadDiagnostics(d => d.SessionName)); + if (lastContact) { - string item = String.Format("{0,9}:{1,20}:", reason, session.SessionDiagnostics.SessionName); - if (lastContact) - { - item += String.Format(":{0:HH:mm:ss}", session.SessionDiagnostics.ClientLastContactTime.ToLocalTime()); - } - else + item += String.Format(":{0:HH:mm:ss}", session.ReadDiagnostics(d => d.ClientLastContactTime).ToLocalTime()); + } + else + { + if (session.Identity != null) { - if (session.Identity != null) - { - item += String.Format(":{0,20}", session.Identity.DisplayName); - } - item += String.Format(":{0}", session.Id); + item += String.Format(":{0,20}", session.Identity.DisplayName); } - Console.WriteLine(item); + item += String.Format(":{0}", session.Id); } + Console.WriteLine(item); } private async Task StatusThreadAsync() diff --git a/Workshop/Aggregation/Server/Aggregation Server.csproj b/Workshop/Aggregation/Server/Aggregation Server.csproj index a4d2b9ebd..bc33434b2 100644 --- a/Workshop/Aggregation/Server/Aggregation Server.csproj +++ b/Workshop/Aggregation/Server/Aggregation Server.csproj @@ -41,17 +41,17 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 - 2.0.158.59919-preview + 2.0.0-preview.2 - 2.0.158.59919-preview + 2.0.0-preview.2 - 2.0.158.59919-preview + 2.0.0-preview.2 - + \ No newline at end of file diff --git a/Workshop/Aggregation/Server/AggregationNodeManager.cs b/Workshop/Aggregation/Server/AggregationNodeManager.cs index a808c7c45..f115194ff 100644 --- a/Workshop/Aggregation/Server/AggregationNodeManager.cs +++ b/Workshop/Aggregation/Server/AggregationNodeManager.cs @@ -1237,7 +1237,7 @@ Opc.Ua.Client.ISession GetClientSession(ServerSystemContext context) if (context != null) { sessionId = context.SessionId ?? NodeId.Null; - sessionName = context.OperationContext.Session.SessionDiagnostics.SessionName; + sessionName = context.OperationContext.Session.ReadDiagnostics(d => d.SessionName); userIdentity = context.UserIdentity; preferredLocales = context.PreferredLocales; } @@ -1492,39 +1492,38 @@ private async void DoMetadataUpdateAsync(object state) "http://opcfoundation.org/UA/Diagnostics" }; - lock (Server.DiagnosticsLock) + // The server owns its diagnostics lock and no longer exposes it; this + // section does not touch the diagnostics summary it guarded. + ushort[] namespaceIndexes = null; + lock (Lock) { - ushort[] namespaceIndexes = null; - lock (Lock) - { - var mapper = new NamespaceMapper(); - mapper.TypeSystemNamespaceUris = TypeSystemNamespaceUris; - mapper.Initialize(Server.NamespaceUris, client.NamespaceUris, m_endpoint.Description.Server.ApplicationUri); - - // set the namespace indexes. - namespaceIndexes = new ushort[mapper.LocalNamespaceIndexes.Length + ((m_ownsTypeModel) ? 1 : 0)]; + var mapper = new NamespaceMapper(); + mapper.TypeSystemNamespaceUris = TypeSystemNamespaceUris; + mapper.Initialize(Server.NamespaceUris, client.NamespaceUris, m_endpoint.Description.Server.ApplicationUri); - int index = 0; - namespaceIndexes[index++] = (ushort)Server.NamespaceUris.GetIndex(Namespaces.Aggregation); + // set the namespace indexes. + namespaceIndexes = new ushort[mapper.LocalNamespaceIndexes.Length + ((m_ownsTypeModel) ? 1 : 0)]; - if (m_ownsTypeModel) - { - namespaceIndexes[index++] = (ushort)Server.NamespaceUris.GetIndex(AggregationModel.Namespaces.Aggregation); - } + int index = 0; + namespaceIndexes[index++] = (ushort)Server.NamespaceUris.GetIndex(Namespaces.Aggregation); - for (int ii = 1; ii < mapper.LocalNamespaceIndexes.Length; ii++) - { - namespaceIndexes[index++] = (ushort)mapper.LocalNamespaceIndexes[ii]; - } - m_mapper = mapper; - SetNamespaceIndexes(namespaceIndexes); + if (m_ownsTypeModel) + { + namespaceIndexes[index++] = (ushort)Server.NamespaceUris.GetIndex(AggregationModel.Namespaces.Aggregation); } - // re-register node manager. - for (int ii = 0; ii < namespaceIndexes.Length; ii++) + for (int ii = 1; ii < mapper.LocalNamespaceIndexes.Length; ii++) { - Server.NodeManager.RegisterNamespaceManager(Server.NamespaceUris.GetString(namespaceIndexes[ii]), this); + namespaceIndexes[index++] = (ushort)mapper.LocalNamespaceIndexes[ii]; } + m_mapper = mapper; + SetNamespaceIndexes(namespaceIndexes); + } + + // re-register node manager. + for (int ii = 0; ii < namespaceIndexes.Length; ii++) + { + Server.NodeManager.RegisterNamespaceManager(Server.NamespaceUris.GetString(namespaceIndexes[ii]), this); } AggregatedTypeCache cache = new AggregatedTypeCache(); diff --git a/Workshop/Aggregation/Server/Browser.cs b/Workshop/Aggregation/Server/Browser.cs index 119ba7edb..811a16030 100644 --- a/Workshop/Aggregation/Server/Browser.cs +++ b/Workshop/Aggregation/Server/Browser.cs @@ -83,10 +83,9 @@ public Browser( /// The next reference that meets the browse criteria. public override IReference Next() { - lock (DataLock) - { - return NextAsync().Result; - } + // NodeBrowser instances are single-consumer and perform no + // synchronization of their own; the former DataLock is gone. + return NextAsync().Result; } public async Task NextAsync(CancellationToken ct = default) diff --git a/Workshop/AlarmCondition/Client/AlarmCondition Client.csproj b/Workshop/AlarmCondition/Client/AlarmCondition Client.csproj index 8dbf8fb46..55b99f2eb 100644 --- a/Workshop/AlarmCondition/Client/AlarmCondition Client.csproj +++ b/Workshop/AlarmCondition/Client/AlarmCondition Client.csproj @@ -33,7 +33,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Workshop/AlarmCondition/Server/AlarmCondition Server.csproj b/Workshop/AlarmCondition/Server/AlarmCondition Server.csproj index 5361bee58..b4576ed08 100644 --- a/Workshop/AlarmCondition/Server/AlarmCondition Server.csproj +++ b/Workshop/AlarmCondition/Server/AlarmCondition Server.csproj @@ -33,12 +33,12 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Workshop/Boiler/Client/Boiler Client.csproj b/Workshop/Boiler/Client/Boiler Client.csproj index c762564ab..da1bb3fbf 100644 --- a/Workshop/Boiler/Client/Boiler Client.csproj +++ b/Workshop/Boiler/Client/Boiler Client.csproj @@ -32,7 +32,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Workshop/Boiler/Server/Boiler Server.csproj b/Workshop/Boiler/Server/Boiler Server.csproj index 1cf1158a2..52f3323a3 100644 --- a/Workshop/Boiler/Server/Boiler Server.csproj +++ b/Workshop/Boiler/Server/Boiler Server.csproj @@ -37,7 +37,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Workshop/Boiler/Server/Quickstarts.Boiler.Classes.cs b/Workshop/Boiler/Server/Quickstarts.Boiler.Classes.cs index b1085982c..bf627cc77 100644 --- a/Workshop/Boiler/Server/Quickstarts.Boiler.Classes.cs +++ b/Workshop/Boiler/Server/Quickstarts.Boiler.Classes.cs @@ -194,7 +194,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -274,7 +275,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion @@ -396,7 +397,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -434,7 +436,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion @@ -554,7 +556,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -592,7 +595,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion @@ -786,7 +789,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -887,7 +891,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion @@ -1415,7 +1419,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -1474,7 +1479,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion @@ -1596,7 +1601,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -1634,7 +1640,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion @@ -1755,7 +1761,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -1793,7 +1800,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion @@ -2060,7 +2067,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -2203,7 +2211,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion diff --git a/Workshop/Common/Quickstart Library.csproj b/Workshop/Common/Quickstart Library.csproj index 4a0124c72..09d0f408c 100644 --- a/Workshop/Common/Quickstart Library.csproj +++ b/Workshop/Common/Quickstart Library.csproj @@ -46,7 +46,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Workshop/Common/QuickstartNodeManager.cs b/Workshop/Common/QuickstartNodeManager.cs index b29328c1e..f61b8553b 100644 --- a/Workshop/Common/QuickstartNodeManager.cs +++ b/Workshop/Common/QuickstartNodeManager.cs @@ -3881,6 +3881,32 @@ public virtual void TransferMonitoredItems( IList monitoredItems, IList processedItems, IList errors) + { + TransferMonitoredItems( + context, + sendInitialValues, + monitoredItems, + processedItems, + errors, + new MonitoredItemTransferOptions()); + } + + /// + /// Transfers a set of monitored items. + /// + /// The context. + /// Whether the subscription should send initial values after transfer. + /// The set of monitoring items to update. + /// The list of bool with items that were already processed. + /// Any errors. + /// Controls how the transfer is executed. + public virtual void TransferMonitoredItems( + OperationContext context, + bool sendInitialValues, + IList monitoredItems, + IList processedItems, + IList errors, + MonitoredItemTransferOptions transferOptions) { ServerSystemContext systemContext = m_systemContext.Copy(context); List transferredItems = new List(); @@ -3905,7 +3931,7 @@ public virtual void TransferMonitoredItems( // owned by this node manager. processedItems[ii] = true; transferredItems.Add(monitoredItems[ii]); - if (sendInitialValues) + if (sendInitialValues && !transferOptions.DeferInitialValues) { monitoredItems[ii].SetupResendDataTrigger(); } diff --git a/Workshop/DataAccess/Client/DataAccess Client.csproj b/Workshop/DataAccess/Client/DataAccess Client.csproj index ba0bcbb21..89fc64a42 100644 --- a/Workshop/DataAccess/Client/DataAccess Client.csproj +++ b/Workshop/DataAccess/Client/DataAccess Client.csproj @@ -33,7 +33,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Workshop/DataAccess/Server/DataAccess Server.csproj b/Workshop/DataAccess/Server/DataAccess Server.csproj index 9d3e038a6..b53bab0e3 100644 --- a/Workshop/DataAccess/Server/DataAccess Server.csproj +++ b/Workshop/DataAccess/Server/DataAccess Server.csproj @@ -34,7 +34,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Workshop/DataAccess/Server/Model/SegmentBrowser.cs b/Workshop/DataAccess/Server/Model/SegmentBrowser.cs index 6b1236183..b163402cc 100644 --- a/Workshop/DataAccess/Server/Model/SegmentBrowser.cs +++ b/Workshop/DataAccess/Server/Model/SegmentBrowser.cs @@ -91,70 +91,69 @@ public override IReference Next() { UnderlyingSystem system = (UnderlyingSystem)this.SystemContext.SystemHandle; - lock (DataLock) - { - IReference reference = null; + // NodeBrowser instances are single-consumer and perform no + // synchronization of their own; the former DataLock is gone. + IReference reference = null; - // enumerate pre-defined references. - // always call first to ensure any pushed-back references are returned first. - reference = base.Next(); + // enumerate pre-defined references. + // always call first to ensure any pushed-back references are returned first. + reference = base.Next(); - if (reference != null) - { - return reference; - } + if (reference != null) + { + return reference; + } - if (m_stage == Stage.Begin) - { - m_segments = system.FindSegments(m_source.SegmentPath); - m_stage = Stage.Segments; - m_position = 0; - } + if (m_stage == Stage.Begin) + { + m_segments = system.FindSegments(m_source.SegmentPath); + m_stage = Stage.Segments; + m_position = 0; + } - // don't start browsing huge number of references when only internal references are requested. - if (InternalOnly) - { - return null; - } + // don't start browsing huge number of references when only internal references are requested. + if (InternalOnly) + { + return null; + } - // enumerate segments. - if (m_stage == Stage.Segments) + // enumerate segments. + if (m_stage == Stage.Segments) + { + if (IsRequired(ReferenceTypeIds.Organizes, false)) { - if (IsRequired(ReferenceTypeIds.Organizes, false)) - { - reference = NextChild(); + reference = NextChild(); - if (reference != null) - { - return reference; - } + if (reference != null) + { + return reference; } - - m_blocks = system.FindBlocks(m_source.SegmentPath); - m_stage = Stage.Blocks; - m_position = 0; } - // enumerate blocks. - if (m_stage == Stage.Blocks) - { - if (IsRequired(ReferenceTypeIds.Organizes, false)) - { - reference = NextChild(); + m_blocks = system.FindBlocks(m_source.SegmentPath); + m_stage = Stage.Blocks; + m_position = 0; + } - if (reference != null) - { - return reference; - } + // enumerate blocks. + if (m_stage == Stage.Blocks) + { + if (IsRequired(ReferenceTypeIds.Organizes, false)) + { + reference = NextChild(); - m_stage = Stage.Done; - m_position = 0; + if (reference != null) + { + return reference; } - } - // all done. - return null; + m_stage = Stage.Done; + m_position = 0; + } } + + // all done. + return null; } #endregion diff --git a/Workshop/DataTypes/Client/DataTypes Client.csproj b/Workshop/DataTypes/Client/DataTypes Client.csproj index a46f953ff..859a012ef 100644 --- a/Workshop/DataTypes/Client/DataTypes Client.csproj +++ b/Workshop/DataTypes/Client/DataTypes Client.csproj @@ -25,7 +25,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Workshop/DataTypes/Common/DataTypes Library.csproj b/Workshop/DataTypes/Common/DataTypes Library.csproj index 29171cdac..b4b66623e 100644 --- a/Workshop/DataTypes/Common/DataTypes Library.csproj +++ b/Workshop/DataTypes/Common/DataTypes Library.csproj @@ -44,7 +44,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Workshop/DataTypes/Common/Types/Quickstarts.DataTypes.Types.Classes.cs b/Workshop/DataTypes/Common/Types/Quickstarts.DataTypes.Types.Classes.cs index d60c213b7..4a2aac05c 100644 --- a/Workshop/DataTypes/Common/Types/Quickstarts.DataTypes.Types.Classes.cs +++ b/Workshop/DataTypes/Common/Types/Quickstarts.DataTypes.Types.Classes.cs @@ -167,7 +167,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -226,7 +227,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion diff --git a/Workshop/DataTypes/Server/DataTypes Server.csproj b/Workshop/DataTypes/Server/DataTypes Server.csproj index 311f74836..0aaa95b9f 100644 --- a/Workshop/DataTypes/Server/DataTypes Server.csproj +++ b/Workshop/DataTypes/Server/DataTypes Server.csproj @@ -38,7 +38,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 \ No newline at end of file diff --git a/Workshop/Empty/Client/Empty Client.csproj b/Workshop/Empty/Client/Empty Client.csproj index 6e7e17d05..3735d9cc4 100644 --- a/Workshop/Empty/Client/Empty Client.csproj +++ b/Workshop/Empty/Client/Empty Client.csproj @@ -31,7 +31,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 \ No newline at end of file diff --git a/Workshop/Empty/Server/Empty Server.csproj b/Workshop/Empty/Server/Empty Server.csproj index 4fda93c1f..fe1395298 100644 --- a/Workshop/Empty/Server/Empty Server.csproj +++ b/Workshop/Empty/Server/Empty Server.csproj @@ -31,7 +31,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 \ No newline at end of file diff --git a/Workshop/HistoricalAccess/Client/HistoricalAccess Client.csproj b/Workshop/HistoricalAccess/Client/HistoricalAccess Client.csproj index 73ecac426..9c354ba1d 100644 --- a/Workshop/HistoricalAccess/Client/HistoricalAccess Client.csproj +++ b/Workshop/HistoricalAccess/Client/HistoricalAccess Client.csproj @@ -30,7 +30,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Workshop/HistoricalAccess/Server/HistoricalAccess Server.csproj b/Workshop/HistoricalAccess/Server/HistoricalAccess Server.csproj index 2b193ecc4..6911bf496 100644 --- a/Workshop/HistoricalAccess/Server/HistoricalAccess Server.csproj +++ b/Workshop/HistoricalAccess/Server/HistoricalAccess Server.csproj @@ -59,7 +59,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Workshop/HistoricalAccess/Server/HistoricalAccessNodeManager.cs b/Workshop/HistoricalAccess/Server/HistoricalAccessNodeManager.cs index 5457989aa..f9652fbae 100644 --- a/Workshop/HistoricalAccess/Server/HistoricalAccessNodeManager.cs +++ b/Workshop/HistoricalAccess/Server/HistoricalAccessNodeManager.cs @@ -120,17 +120,16 @@ public override NodeId New(ISystemContext context, NodeState node) /// public override void CreateAddressSpace(IDictionary> externalReferences) { - lock (Server.DiagnosticsLock) - { - HistoryServerCapabilitiesState capabilities = Server.DiagnosticsNodeManager.GetDefaultHistoryCapabilitiesAsync(System.Threading.CancellationToken.None).GetAwaiter().GetResult(); - capabilities.AccessHistoryDataCapability.Value = true; - capabilities.InsertDataCapability.Value = true; - capabilities.ReplaceDataCapability.Value = true; - capabilities.UpdateDataCapability.Value = true; - capabilities.DeleteRawCapability.Value = true; - capabilities.DeleteAtTimeCapability.Value = true; - capabilities.InsertAnnotationCapability.Value = true; - } + // The server owns its diagnostics lock and no longer exposes it; this + // section does not touch the diagnostics summary it guarded. + HistoryServerCapabilitiesState capabilities = Server.DiagnosticsNodeManager.GetDefaultHistoryCapabilitiesAsync(System.Threading.CancellationToken.None).GetAwaiter().GetResult(); + capabilities.AccessHistoryDataCapability.Value = true; + capabilities.InsertDataCapability.Value = true; + capabilities.ReplaceDataCapability.Value = true; + capabilities.UpdateDataCapability.Value = true; + capabilities.DeleteRawCapability.Value = true; + capabilities.DeleteAtTimeCapability.Value = true; + capabilities.InsertAnnotationCapability.Value = true; lock (Lock) { @@ -1643,13 +1642,18 @@ private DataValue RowToDataValue( /// /// Stores a read history request. /// - private sealed class HistoryReadRequest + private sealed class HistoryReadRequest : IHistoryContinuationPoint { + public Guid Id { get; set; } public ByteString ContinuationPoint; public LinkedList Values; public LinkedList ModificationInfos; public uint NumValuesPerNode; public AggregateFilter Filter; + + public void Dispose() + { + } } /// @@ -1695,7 +1699,7 @@ private HistoryReadRequest LoadContinuationPoint( return null; } - HistoryReadRequest request = session.RestoreHistoryContinuationPoint(continuationPoint) as HistoryReadRequest; + HistoryReadRequest request = session.ContinuationPoints.RestoreHistory(continuationPoint) as HistoryReadRequest; if (request == null) { @@ -1719,9 +1723,9 @@ private ByteString SaveContinuationPoint( return default; } - Guid id = Guid.NewGuid(); - session.SaveHistoryContinuationPoint(id, request); - request.ContinuationPoint = id.ToByteArray().ToByteString(); + request.Id = Guid.NewGuid(); + session.ContinuationPoints.SaveHistory(request); + request.ContinuationPoint = request.Id.ToByteArray().ToByteString(); return request.ContinuationPoint; } #endregion diff --git a/Workshop/HistoricalAccess/Server/Model/SegmentBrowser.cs b/Workshop/HistoricalAccess/Server/Model/SegmentBrowser.cs index 213851119..06a620512 100644 --- a/Workshop/HistoricalAccess/Server/Model/SegmentBrowser.cs +++ b/Workshop/HistoricalAccess/Server/Model/SegmentBrowser.cs @@ -91,70 +91,69 @@ public override IReference Next() { UnderlyingSystem system = (UnderlyingSystem)this.SystemContext.SystemHandle; - lock (DataLock) + // NodeBrowser instances are single-consumer and perform no + // synchronization of their own; the former DataLock is gone. + IReference reference = null; + + // enumerate pre-defined references. + // always call first to ensure any pushed-back references are returned first. + reference = base.Next(); + + if (reference != null) { - IReference reference = null; + return reference; + } - // enumerate pre-defined references. - // always call first to ensure any pushed-back references are returned first. - reference = base.Next(); + if (m_stage == Stage.Begin) + { + m_segments = system.FindSegments(m_source.SegmentPath); + m_stage = Stage.Segments; + m_position = 0; + } - if (reference != null) + // don't start browsing huge number of references when only internal references are requested. + if (InternalOnly) + { + return null; + } + + // enumerate segments. + if (m_stage == Stage.Segments) + { + if (IsRequired(ReferenceTypeIds.Organizes, false)) { - return reference; - } + reference = NextChild(); - if (m_stage == Stage.Begin) - { - m_segments = system.FindSegments(m_source.SegmentPath); - m_stage = Stage.Segments; - m_position = 0; + if (reference != null) + { + return reference; + } } - // don't start browsing huge number of references when only internal references are requested. - if (InternalOnly) - { - return null; - } - - // enumerate segments. - if (m_stage == Stage.Segments) + m_blocks = system.FindBlocks(m_source.SegmentPath); + m_stage = Stage.Blocks; + m_position = 0; + } + + // enumerate blocks. + if (m_stage == Stage.Blocks) + { + if (IsRequired(ReferenceTypeIds.Organizes, false)) { - if (IsRequired(ReferenceTypeIds.Organizes, false)) - { - reference = NextChild(); + reference = NextChild(); - if (reference != null) - { - return reference; - } + if (reference != null) + { + return reference; } - m_blocks = system.FindBlocks(m_source.SegmentPath); - m_stage = Stage.Blocks; + m_stage = Stage.Done; m_position = 0; } - - // enumerate blocks. - if (m_stage == Stage.Blocks) - { - if (IsRequired(ReferenceTypeIds.Organizes, false)) - { - reference = NextChild(); - - if (reference != null) - { - return reference; - } - - m_stage = Stage.Done; - m_position = 0; - } - } - - // all done. - return null; } + + // all done. + return null; } #endregion diff --git a/Workshop/HistoricalAccess/Server/UnderlyingSystem/ArchiveFolderBrowser.cs b/Workshop/HistoricalAccess/Server/UnderlyingSystem/ArchiveFolderBrowser.cs index 3dd81ab1e..27cd6b96d 100644 --- a/Workshop/HistoricalAccess/Server/UnderlyingSystem/ArchiveFolderBrowser.cs +++ b/Workshop/HistoricalAccess/Server/UnderlyingSystem/ArchiveFolderBrowser.cs @@ -91,87 +91,86 @@ public override IReference Next() { UnderlyingSystem system = (UnderlyingSystem)this.SystemContext.SystemHandle; - lock (DataLock) + // NodeBrowser instances are single-consumer and perform no + // synchronization of their own; the former DataLock is gone. + IReference reference = null; + + // enumerate pre-defined references. + // always call first to ensure any pushed-back references are returned first. + reference = base.Next(); + + if (reference != null) { - IReference reference = null; + return reference; + } - // enumerate pre-defined references. - // always call first to ensure any pushed-back references are returned first. - reference = base.Next(); + if (m_stage == Stage.Begin) + { + m_folders = m_source.ArchiveFolder.GetChildFolders(); + m_stage = Stage.Folders; + m_position = 0; + } - if (reference != null) - { - return reference; - } + // don't start browsing huge number of references when only internal references are requested. + if (InternalOnly) + { + return null; + } - if (m_stage == Stage.Begin) + // enumerate folders. + if (m_stage == Stage.Folders) + { + if (IsRequired(ReferenceTypeIds.Organizes, false)) { - m_folders = m_source.ArchiveFolder.GetChildFolders(); - m_stage = Stage.Folders; - m_position = 0; - } + reference = NextChild(); - // don't start browsing huge number of references when only internal references are requested. - if (InternalOnly) - { - return null; + if (reference != null) + { + return reference; + } } - // enumerate folders. - if (m_stage == Stage.Folders) + m_items = m_source.ArchiveFolder.GetItems(); + m_stage = Stage.Items; + m_position = 0; + } + + // enumerate items. + if (m_stage == Stage.Items) + { + if (IsRequired(ReferenceTypeIds.Organizes, false)) { - if (IsRequired(ReferenceTypeIds.Organizes, false)) - { - reference = NextChild(); + reference = NextChild(); - if (reference != null) - { - return reference; - } + if (reference != null) + { + return reference; } - m_items = m_source.ArchiveFolder.GetItems(); - m_stage = Stage.Items; + m_stage = Stage.Parents; m_position = 0; } + } - // enumerate items. - if (m_stage == Stage.Items) + // enumerate parents. + if (m_stage == Stage.Parents) + { + if (IsRequired(ReferenceTypeIds.Organizes, true)) { - if (IsRequired(ReferenceTypeIds.Organizes, false)) - { - reference = NextChild(); - - if (reference != null) - { - return reference; - } - - m_stage = Stage.Parents; - m_position = 0; - } - } + reference = NextChild(); - // enumerate parents. - if (m_stage == Stage.Parents) - { - if (IsRequired(ReferenceTypeIds.Organizes, true)) + if (reference != null) { - reference = NextChild(); - - if (reference != null) - { - return reference; - } - - m_stage = Stage.Done; - m_position = 0; + return reference; } - } - // all done. - return null; + m_stage = Stage.Done; + m_position = 0; + } } + + // all done. + return null; } #endregion diff --git a/Workshop/HistoricalAccess/Tester/Aggregate Tester.csproj b/Workshop/HistoricalAccess/Tester/Aggregate Tester.csproj index 89e1f7de7..9b062ff59 100644 --- a/Workshop/HistoricalAccess/Tester/Aggregate Tester.csproj +++ b/Workshop/HistoricalAccess/Tester/Aggregate Tester.csproj @@ -34,10 +34,10 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 - 2.0.158.59919-preview + 2.0.0-preview.2 \ No newline at end of file diff --git a/Workshop/HistoricalEvents/Client/HistoricalEvents Client.csproj b/Workshop/HistoricalEvents/Client/HistoricalEvents Client.csproj index cc2de05a0..6ef393c89 100644 --- a/Workshop/HistoricalEvents/Client/HistoricalEvents Client.csproj +++ b/Workshop/HistoricalEvents/Client/HistoricalEvents Client.csproj @@ -34,7 +34,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Workshop/HistoricalEvents/Client/Quickstarts.HistoricalEvents.Classes.cs b/Workshop/HistoricalEvents/Client/Quickstarts.HistoricalEvents.Classes.cs index 23dca3e0c..9e6444e08 100644 --- a/Workshop/HistoricalEvents/Client/Quickstarts.HistoricalEvents.Classes.cs +++ b/Workshop/HistoricalEvents/Client/Quickstarts.HistoricalEvents.Classes.cs @@ -231,7 +231,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -332,7 +333,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion @@ -500,7 +501,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -559,7 +561,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion @@ -723,7 +725,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -782,7 +785,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion diff --git a/Workshop/HistoricalEvents/Server/HistoricalEvents Server.csproj b/Workshop/HistoricalEvents/Server/HistoricalEvents Server.csproj index 774adefef..10146ed65 100644 --- a/Workshop/HistoricalEvents/Server/HistoricalEvents Server.csproj +++ b/Workshop/HistoricalEvents/Server/HistoricalEvents Server.csproj @@ -36,7 +36,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 \ No newline at end of file diff --git a/Workshop/HistoricalEvents/Server/HistoricalEventsNodeManager.cs b/Workshop/HistoricalEvents/Server/HistoricalEventsNodeManager.cs index 8ee770b1e..e8619c3f8 100644 --- a/Workshop/HistoricalEvents/Server/HistoricalEventsNodeManager.cs +++ b/Workshop/HistoricalEvents/Server/HistoricalEventsNodeManager.cs @@ -595,14 +595,19 @@ private HistoryReadRequest CreateHistoryReadRequest( /// /// Stores a read history request. /// - private sealed class HistoryReadRequest + private sealed class HistoryReadRequest : IHistoryContinuationPoint { + public Guid Id { get; set; } public ByteString ContinuationPoint; public LinkedList Events; public bool TimeFlowsBackward; public uint NumValuesPerNode; public EventFilter Filter; public FilterContext FilterContext; + + public void Dispose() + { + } } /// @@ -648,7 +653,7 @@ private HistoryReadRequest LoadContinuationPoint( return null; } - HistoryReadRequest request = session.RestoreHistoryContinuationPoint(continuationPoint) as HistoryReadRequest; + HistoryReadRequest request = session.ContinuationPoints.RestoreHistory(continuationPoint) as HistoryReadRequest; if (request == null) { @@ -672,9 +677,9 @@ private ByteString SaveContinuationPoint( return default; } - Guid id = Guid.NewGuid(); - session.SaveHistoryContinuationPoint(id, request); - request.ContinuationPoint = id.ToByteArray().ToByteString(); + request.Id = Guid.NewGuid(); + session.ContinuationPoints.SaveHistory(request); + request.ContinuationPoint = request.Id.ToByteArray().ToByteString(); return request.ContinuationPoint; } #endregion diff --git a/Workshop/HistoricalEvents/Server/Model/Quickstarts.HistoricalEvents.Classes.cs b/Workshop/HistoricalEvents/Server/Model/Quickstarts.HistoricalEvents.Classes.cs index 23dca3e0c..9e6444e08 100644 --- a/Workshop/HistoricalEvents/Server/Model/Quickstarts.HistoricalEvents.Classes.cs +++ b/Workshop/HistoricalEvents/Server/Model/Quickstarts.HistoricalEvents.Classes.cs @@ -231,7 +231,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -332,7 +333,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion @@ -500,7 +501,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -559,7 +561,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion @@ -723,7 +725,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -782,7 +785,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion diff --git a/Workshop/Methods/Client/Methods Client.csproj b/Workshop/Methods/Client/Methods Client.csproj index 78044a2b9..a1386faf5 100644 --- a/Workshop/Methods/Client/Methods Client.csproj +++ b/Workshop/Methods/Client/Methods Client.csproj @@ -30,7 +30,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 \ No newline at end of file diff --git a/Workshop/Methods/Server/Methods Server.csproj b/Workshop/Methods/Server/Methods Server.csproj index b837f1516..34edcf3ef 100644 --- a/Workshop/Methods/Server/Methods Server.csproj +++ b/Workshop/Methods/Server/Methods Server.csproj @@ -31,7 +31,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 \ No newline at end of file diff --git a/Workshop/PerfTest/Client/PerfTest Client.csproj b/Workshop/PerfTest/Client/PerfTest Client.csproj index 647b10c31..5d97c7b77 100644 --- a/Workshop/PerfTest/Client/PerfTest Client.csproj +++ b/Workshop/PerfTest/Client/PerfTest Client.csproj @@ -30,7 +30,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 \ No newline at end of file diff --git a/Workshop/PerfTest/Server/MemoryRegisterState.cs b/Workshop/PerfTest/Server/MemoryRegisterState.cs index 9f13a6b40..8b7ff309b 100644 --- a/Workshop/PerfTest/Server/MemoryRegisterState.cs +++ b/Workshop/PerfTest/Server/MemoryRegisterState.cs @@ -168,48 +168,47 @@ public override IReference Next() { UnderlyingSystem system = (UnderlyingSystem)this.SystemContext.SystemHandle; - lock (DataLock) - { - IReference reference = null; + // NodeBrowser instances are single-consumer and perform no + // synchronization of their own; the former DataLock is gone. + IReference reference = null; - // enumerate pre-defined references. - // always call first to ensure any pushed-back references are returned first. - reference = base.Next(); + // enumerate pre-defined references. + // always call first to ensure any pushed-back references are returned first. + reference = base.Next(); - if (reference != null) - { - return reference; - } + if (reference != null) + { + return reference; + } - if (m_stage == Stage.Begin) - { - m_stage = Stage.Tags; - m_position = 0; - } + if (m_stage == Stage.Begin) + { + m_stage = Stage.Tags; + m_position = 0; + } - // don't start browsing huge number of references when only internal references are requested. - if (InternalOnly) - { - return null; - } + // don't start browsing huge number of references when only internal references are requested. + if (InternalOnly) + { + return null; + } - // enumerate tags. - if (m_stage == Stage.Tags) + // enumerate tags. + if (m_stage == Stage.Tags) + { + if (IsRequired(ReferenceTypeIds.Organizes, false)) { - if (IsRequired(ReferenceTypeIds.Organizes, false)) - { - reference = NextChild(); + reference = NextChild(); - if (reference != null) - { - return reference; - } + if (reference != null) + { + return reference; } } - - // all done. - return null; } + + // all done. + return null; } #endregion diff --git a/Workshop/PerfTest/Server/PerfTest Server.csproj b/Workshop/PerfTest/Server/PerfTest Server.csproj index 299f8ec7b..63570114b 100644 --- a/Workshop/PerfTest/Server/PerfTest Server.csproj +++ b/Workshop/PerfTest/Server/PerfTest Server.csproj @@ -31,7 +31,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 \ No newline at end of file diff --git a/Workshop/SimpleEvents/Client/Quickstarts.SimpleEvents.Classes.cs b/Workshop/SimpleEvents/Client/Quickstarts.SimpleEvents.Classes.cs index 74f123c65..4d133b497 100644 --- a/Workshop/SimpleEvents/Client/Quickstarts.SimpleEvents.Classes.cs +++ b/Workshop/SimpleEvents/Client/Quickstarts.SimpleEvents.Classes.cs @@ -176,7 +176,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -235,7 +236,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion @@ -364,7 +365,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -402,7 +404,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion @@ -543,7 +545,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -581,7 +584,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion diff --git a/Workshop/SimpleEvents/Client/SimpleEvents Client.csproj b/Workshop/SimpleEvents/Client/SimpleEvents Client.csproj index c8ab64b18..7e8174fcf 100644 --- a/Workshop/SimpleEvents/Client/SimpleEvents Client.csproj +++ b/Workshop/SimpleEvents/Client/SimpleEvents Client.csproj @@ -27,7 +27,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 diff --git a/Workshop/SimpleEvents/Server/Quickstarts.SimpleEvents.Classes.cs b/Workshop/SimpleEvents/Server/Quickstarts.SimpleEvents.Classes.cs index 74f123c65..4d133b497 100644 --- a/Workshop/SimpleEvents/Server/Quickstarts.SimpleEvents.Classes.cs +++ b/Workshop/SimpleEvents/Server/Quickstarts.SimpleEvents.Classes.cs @@ -176,7 +176,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -235,7 +236,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion @@ -364,7 +365,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -402,7 +404,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion @@ -543,7 +545,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -581,7 +584,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion diff --git a/Workshop/SimpleEvents/Server/SimpleEvents Server.csproj b/Workshop/SimpleEvents/Server/SimpleEvents Server.csproj index 32fe78024..33d5b7a85 100644 --- a/Workshop/SimpleEvents/Server/SimpleEvents Server.csproj +++ b/Workshop/SimpleEvents/Server/SimpleEvents Server.csproj @@ -35,7 +35,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 \ No newline at end of file diff --git a/Workshop/UserAuthentication/Client/UserAuthentication Client.csproj b/Workshop/UserAuthentication/Client/UserAuthentication Client.csproj index 132be9446..6012d506c 100644 --- a/Workshop/UserAuthentication/Client/UserAuthentication Client.csproj +++ b/Workshop/UserAuthentication/Client/UserAuthentication Client.csproj @@ -30,7 +30,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 \ No newline at end of file diff --git a/Workshop/UserAuthentication/Server/UserAuthentication Server.csproj b/Workshop/UserAuthentication/Server/UserAuthentication Server.csproj index 5ac88b6f0..f3bbfe12a 100644 --- a/Workshop/UserAuthentication/Server/UserAuthentication Server.csproj +++ b/Workshop/UserAuthentication/Server/UserAuthentication Server.csproj @@ -31,8 +31,8 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 - + \ No newline at end of file diff --git a/Workshop/Views/Client/Views Client.csproj b/Workshop/Views/Client/Views Client.csproj index 7269aa5b5..b085d804d 100644 --- a/Workshop/Views/Client/Views Client.csproj +++ b/Workshop/Views/Client/Views Client.csproj @@ -30,7 +30,7 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 \ No newline at end of file diff --git a/Workshop/Views/Server/Model/Quickstarts.Views.Classes.cs b/Workshop/Views/Server/Model/Quickstarts.Views.Classes.cs index 13ae710b1..959a7a052 100644 --- a/Workshop/Views/Server/Model/Quickstarts.Views.Classes.cs +++ b/Workshop/Views/Server/Model/Quickstarts.Views.Classes.cs @@ -225,7 +225,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -326,7 +327,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion @@ -679,7 +680,8 @@ protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, - BaseInstanceState replacement) + BaseInstanceState replacement, + bool assignInstanceNodeIds = true) { if ((browseName).IsNull) { @@ -759,7 +761,7 @@ protected override BaseInstanceState FindChild( return instance; } - return base.FindChild(context, browseName, createOrReplace, replacement); + return base.FindChild(context, browseName, createOrReplace, replacement, assignInstanceNodeIds); } #endregion diff --git a/Workshop/Views/Server/Views Server.csproj b/Workshop/Views/Server/Views Server.csproj index f6a096d35..d2233ae59 100644 --- a/Workshop/Views/Server/Views Server.csproj +++ b/Workshop/Views/Server/Views Server.csproj @@ -41,9 +41,9 @@ 10.0.10 - 2.0.158.59919-preview + 2.0.0-preview.2 - +