Skip to content

Commit

Permalink
changing line endings
Browse files Browse the repository at this point in the history
  • Loading branch information
JackLewis-digirati committed Aug 16, 2023
1 parent 80367b4 commit 065c999
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions src/protagonist/DLCS.Model/Storage/AssetStorageMetric.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
namespace DLCS.Model.Storage;

public class AssetStorageMetric
{
public CustomerStorage CustomerStorage { get; set; }
public StoragePolicy Policy { get; set; }
public long MaximumNumberOfStoredImages => Policy.MaximumNumberOfStoredImages;
public long CurrentNumberOfStoredImages => CustomerStorage.NumberOfStoredImages;
public long MaximumTotalSizeOfStoredImages => Policy.MaximumTotalSizeOfStoredImages;
public long CurrentTotalSizeStoredImages => CustomerStorage.TotalSizeOfStoredImages;

/// <summary>
/// Check if there is allowance to store the specific number of assets.
/// </summary>
public bool CanStoreAsset(int assetCount = 1) =>
CustomerStorage.NumberOfStoredImages + assetCount <= Policy.MaximumNumberOfStoredImages;

/// <summary>
/// Check if there is allowance to store asset based on size
/// </summary>
public bool CanStoreAssetSize(long proposedNewSize, long oldFileSize) =>
(CustomerStorage.TotalSizeOfStoredImages - oldFileSize) + proposedNewSize <= Policy.MaximumTotalSizeOfStoredImages;
namespace DLCS.Model.Storage;

public class AssetStorageMetric
{
public CustomerStorage CustomerStorage { get; set; }
public StoragePolicy Policy { get; set; }
public long MaximumNumberOfStoredImages => Policy.MaximumNumberOfStoredImages;
public long CurrentNumberOfStoredImages => CustomerStorage.NumberOfStoredImages;
public long MaximumTotalSizeOfStoredImages => Policy.MaximumTotalSizeOfStoredImages;
public long CurrentTotalSizeStoredImages => CustomerStorage.TotalSizeOfStoredImages;

/// <summary>
/// Check if there is allowance to store the specific number of assets.
/// </summary>
public bool CanStoreAsset(int assetCount = 1) =>
CustomerStorage.NumberOfStoredImages + assetCount <= Policy.MaximumNumberOfStoredImages;

/// <summary>
/// Check if there is allowance to store asset based on size
/// </summary>
public bool CanStoreAssetSize(long proposedNewSize, long oldFileSize) =>
(CustomerStorage.TotalSizeOfStoredImages - oldFileSize) + proposedNewSize <= Policy.MaximumTotalSizeOfStoredImages;
}

0 comments on commit 065c999

Please sign in to comment.