1d5465f31c
Deleting an instance only undeployed it from the site and set the state to NotDeployed, leaving an orphan record that could never be removed — the state-transition matrix rejected delete from NotDeployed. Delete now removes the instance record entirely (deployment history, snapshot, attribute/alarm overrides, and connection bindings go with it), and is permitted from any state.
46 lines
3.1 KiB
C#
46 lines
3.1 KiB
C#
using ScadaLink.Commons.Entities.Deployment;
|
|
using ScadaLink.Commons.Entities.Instances;
|
|
using ScadaLink.Commons.Types.Enums;
|
|
|
|
namespace ScadaLink.Commons.Interfaces.Repositories;
|
|
|
|
public interface IDeploymentManagerRepository
|
|
{
|
|
// DeploymentRecord
|
|
Task<DeploymentRecord?> GetDeploymentRecordByIdAsync(int id, CancellationToken cancellationToken = default);
|
|
Task<IReadOnlyList<DeploymentRecord>> GetAllDeploymentRecordsAsync(CancellationToken cancellationToken = default);
|
|
Task<IReadOnlyList<DeploymentRecord>> GetDeploymentsByInstanceIdAsync(int instanceId, CancellationToken cancellationToken = default);
|
|
Task<DeploymentRecord?> GetCurrentDeploymentStatusAsync(int instanceId, CancellationToken cancellationToken = default);
|
|
Task<DeploymentRecord?> GetDeploymentByDeploymentIdAsync(string deploymentId, CancellationToken cancellationToken = default);
|
|
Task AddDeploymentRecordAsync(DeploymentRecord record, CancellationToken cancellationToken = default);
|
|
Task UpdateDeploymentRecordAsync(DeploymentRecord record, CancellationToken cancellationToken = default);
|
|
Task DeleteDeploymentRecordAsync(int id, CancellationToken cancellationToken = default);
|
|
|
|
// SystemArtifactDeploymentRecord
|
|
Task<SystemArtifactDeploymentRecord?> GetSystemArtifactDeploymentByIdAsync(int id, CancellationToken cancellationToken = default);
|
|
Task<IReadOnlyList<SystemArtifactDeploymentRecord>> GetAllSystemArtifactDeploymentsAsync(CancellationToken cancellationToken = default);
|
|
Task AddSystemArtifactDeploymentAsync(SystemArtifactDeploymentRecord record, CancellationToken cancellationToken = default);
|
|
Task UpdateSystemArtifactDeploymentAsync(SystemArtifactDeploymentRecord record, CancellationToken cancellationToken = default);
|
|
Task DeleteSystemArtifactDeploymentAsync(int id, CancellationToken cancellationToken = default);
|
|
|
|
// WP-8: DeployedConfigSnapshot
|
|
Task<DeployedConfigSnapshot?> GetDeployedSnapshotByInstanceIdAsync(int instanceId, CancellationToken cancellationToken = default);
|
|
Task AddDeployedSnapshotAsync(DeployedConfigSnapshot snapshot, CancellationToken cancellationToken = default);
|
|
Task UpdateDeployedSnapshotAsync(DeployedConfigSnapshot snapshot, CancellationToken cancellationToken = default);
|
|
Task DeleteDeployedSnapshotAsync(int instanceId, CancellationToken cancellationToken = default);
|
|
|
|
// Instance lookups for deployment pipeline
|
|
Task<Instance?> GetInstanceByIdAsync(int instanceId, CancellationToken cancellationToken = default);
|
|
Task<Instance?> GetInstanceByUniqueNameAsync(string uniqueName, CancellationToken cancellationToken = default);
|
|
Task UpdateInstanceAsync(Instance instance, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Removes an instance and everything that depends on it: deployment
|
|
/// records, deployed config snapshot, attribute/alarm overrides, and
|
|
/// connection bindings.
|
|
/// </summary>
|
|
Task DeleteInstanceAsync(int instanceId, CancellationToken cancellationToken = default);
|
|
|
|
Task<int> SaveChangesAsync(CancellationToken cancellationToken = default);
|
|
}
|