/* ======================================================================== * Copyright (c) 2005-2025 The OPC Foundation, Inc. All rights reserved. * * OPC Foundation MIT License 1.00 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * The complete license agreement can be found here: * http://opcfoundation.org/License/MIT/1.00/ * ======================================================================*/ using System.Collections.Generic; using System.IO; using System.Threading; using System.Threading.Tasks; namespace Opc.Ua.Di.Server.SoftwareUpdate { /// /// Multi-version software repository for one DI topology element /// (typically a device). Models OPC 10000-100 §10.3.5 /// SoftwareFolderType — the folder under /// SoftwareType that lists every known software version /// (current, previous, future) and tracks which one is currently /// active on the device. /// /// /// /// Implementations are scoped to a single topology element. Use /// one folder instance per device that supports the /// SoftwareFolderType facet. /// /// /// All operations must be safe for concurrent calls. /// /// public interface ISoftwareFolder { /// /// The topology element this folder belongs to (typically a /// device NodeId). /// NodeId ElementId { get; } /// /// Streams every software version known to the folder. /// IAsyncEnumerable ListVersionsAsync( CancellationToken cancellationToken = default); /// /// Returns the version currently marked as active on the /// device, or when no version is /// active. /// ValueTask GetCurrentVersionAsync( CancellationToken cancellationToken = default); /// /// Returns the package with the supplied /// identifier; or /// when no such version exists. /// ValueTask GetVersionAsync( string version, CancellationToken cancellationToken = default); /// /// Opens the binary payload of the version for reading. /// ValueTask OpenVersionAsync( string version, CancellationToken cancellationToken = default); /// /// Adds a new software version. If a version with the same /// identifier already exists it is replaced. /// ValueTask AddVersionAsync( SoftwarePackage metadata, Stream payload, CancellationToken cancellationToken = default); /// /// Removes the version with the supplied identifier. Returns /// when a version was removed. /// ValueTask RemoveVersionAsync( string version, CancellationToken cancellationToken = default); /// /// Marks the supplied version as the currently active one on /// the device. Throws /// when the version is unknown. /// ValueTask SetCurrentVersionAsync( string version, CancellationToken cancellationToken = default); } }