Skip to content

Commit

Permalink
Refactor BlobWrapper design to accomodate disposal and reference trac…
Browse files Browse the repository at this point in the history
…king requirements.
  • Loading branch information
lilith committed Mar 18, 2024
1 parent cde118f commit c3ce0bd
Show file tree
Hide file tree
Showing 73 changed files with 1,704 additions and 855 deletions.
4 changes: 2 additions & 2 deletions examples/Imageflow.Server.Example/CustomBlobService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public async Task<CodeResult<IBlobWrapper>> Fetch(string virtualPath)
}
internal static class CustomAzureBlobHelpers
{
public static IConsumableBlob CreateAzureBlob(Response<BlobDownloadInfo> response)
public static StreamBlob CreateAzureBlob(Response<BlobDownloadInfo> response)
{
var a = new BlobAttributes()
{
Expand All @@ -142,7 +142,7 @@ public static IConsumableBlob CreateAzureBlob(Response<BlobDownloadInfo> respons

};
var stream = response.Value.Content;
return new ConsumableStreamBlob(a, stream);
return new StreamBlob(a, stream);
}
}
}
28 changes: 16 additions & 12 deletions examples/Imageflow.Server.Example/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@
},
"Imageflow.AllPlatforms": {
"type": "Transitive",
"resolved": "0.13.0",
"contentHash": "IlLfRRfyicRgWTrWApZvFWhJ1vaUNdSxG6qS1Ej/dj9TrKeomJzvB0kqrvci/Rz80TSyxrQX1vWGCL2Dhe8o1Q==",
"resolved": "0.13.1",
"contentHash": "cOuUD9JqwgGqkOwaXe3rjmHdA8F1x1Bqsu4m9x9tgJUGsMqytOeujYHz/trctU+VY8rODoCVw4fStJ8vVELIeQ==",
"dependencies": {
"Imageflow.NativeRuntime.osx-x86_64": "2.0.0-preview8",
"Imageflow.NativeRuntime.ubuntu-x86_64": "2.0.0-preview8",
"Imageflow.NativeRuntime.win-x86": "2.0.0-preview8",
"Imageflow.NativeRuntime.win-x86_64": "2.0.0-preview8",
"Imageflow.Net": "0.13.0"
"Imageflow.Net": "0.13.1"
}
},
"Imageflow.NativeRuntime.osx-x86_64": {
Expand All @@ -123,8 +123,8 @@
},
"Imageflow.Net": {
"type": "Transitive",
"resolved": "0.13.0",
"contentHash": "nH3P2rLt5rNjPnDlCJ2n1qHLloNc0n+Iym8OVqk6neyW7+Gamuo4iuAXm4daQvcr354qD0St28kyl7j66oMC9g==",
"resolved": "0.13.1",
"contentHash": "QHSghMGgiy4DhRloqEgNaaY+AM/28mwSF5Q371B90JyKDGIEtJPYMX+d8AkCmHuuf9Tgc6Zl8v+9ieY5yXGcNw==",
"dependencies": {
"Microsoft.IO.RecyclableMemoryStream": "[3.0.0, 4.0.0)",
"System.Text.Json": "6.0.9"
Expand Down Expand Up @@ -411,7 +411,7 @@
"imageflow.server": {
"type": "Project",
"dependencies": {
"Imageflow.AllPlatforms": "[0.13.0, )",
"Imageflow.AllPlatforms": "[0.13.1, )",
"Imazen.Common": "[0.1.0--notset, )",
"Imazen.Routing": "[0.1.0--notset, )",
"Microsoft.IO.RecyclableMemoryStream": "[3.0.0, )"
Expand Down Expand Up @@ -451,7 +451,9 @@
"imazen.abstractions": {
"type": "Project",
"dependencies": {
"CommunityToolkit.HighPerformance": "[8.*, )",
"Microsoft.Extensions.Hosting.Abstractions": "[2.*, )",
"System.Collections.Immutable": "[6.*, )",
"System.Text.Encodings.Web": "[6.*, )"
}
},
Expand Down Expand Up @@ -571,14 +573,14 @@
},
"Imageflow.AllPlatforms": {
"type": "Transitive",
"resolved": "0.13.0",
"contentHash": "IlLfRRfyicRgWTrWApZvFWhJ1vaUNdSxG6qS1Ej/dj9TrKeomJzvB0kqrvci/Rz80TSyxrQX1vWGCL2Dhe8o1Q==",
"resolved": "0.13.1",
"contentHash": "cOuUD9JqwgGqkOwaXe3rjmHdA8F1x1Bqsu4m9x9tgJUGsMqytOeujYHz/trctU+VY8rODoCVw4fStJ8vVELIeQ==",
"dependencies": {
"Imageflow.NativeRuntime.osx-x86_64": "2.0.0-preview8",
"Imageflow.NativeRuntime.ubuntu-x86_64": "2.0.0-preview8",
"Imageflow.NativeRuntime.win-x86": "2.0.0-preview8",
"Imageflow.NativeRuntime.win-x86_64": "2.0.0-preview8",
"Imageflow.Net": "0.13.0"
"Imageflow.Net": "0.13.1"
}
},
"Imageflow.NativeRuntime.osx-x86_64": {
Expand All @@ -603,8 +605,8 @@
},
"Imageflow.Net": {
"type": "Transitive",
"resolved": "0.13.0",
"contentHash": "nH3P2rLt5rNjPnDlCJ2n1qHLloNc0n+Iym8OVqk6neyW7+Gamuo4iuAXm4daQvcr354qD0St28kyl7j66oMC9g==",
"resolved": "0.13.1",
"contentHash": "QHSghMGgiy4DhRloqEgNaaY+AM/28mwSF5Q371B90JyKDGIEtJPYMX+d8AkCmHuuf9Tgc6Zl8v+9ieY5yXGcNw==",
"dependencies": {
"Microsoft.IO.RecyclableMemoryStream": "[3.0.0, 4.0.0)",
"System.Text.Json": "6.0.9"
Expand Down Expand Up @@ -891,7 +893,7 @@
"imageflow.server": {
"type": "Project",
"dependencies": {
"Imageflow.AllPlatforms": "[0.13.0, )",
"Imageflow.AllPlatforms": "[0.13.1, )",
"Imazen.Common": "[0.1.0--notset, )",
"Imazen.Routing": "[0.1.0--notset, )",
"Microsoft.IO.RecyclableMemoryStream": "[3.0.0, )"
Expand Down Expand Up @@ -931,7 +933,9 @@
"imazen.abstractions": {
"type": "Project",
"dependencies": {
"CommunityToolkit.HighPerformance": "[8.*, )",
"Microsoft.Extensions.Hosting.Abstractions": "[2.*, )",
"System.Collections.Immutable": "[6.*, )",
"System.Text.Encodings.Web": "[6.*, )"
}
},
Expand Down
14 changes: 8 additions & 6 deletions examples/Imageflow.Server.ExampleMinimal/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
},
"Imageflow.AllPlatforms": {
"type": "Transitive",
"resolved": "0.13.0",
"contentHash": "IlLfRRfyicRgWTrWApZvFWhJ1vaUNdSxG6qS1Ej/dj9TrKeomJzvB0kqrvci/Rz80TSyxrQX1vWGCL2Dhe8o1Q==",
"resolved": "0.13.1",
"contentHash": "cOuUD9JqwgGqkOwaXe3rjmHdA8F1x1Bqsu4m9x9tgJUGsMqytOeujYHz/trctU+VY8rODoCVw4fStJ8vVELIeQ==",
"dependencies": {
"Imageflow.NativeRuntime.osx-x86_64": "2.0.0-preview8",
"Imageflow.NativeRuntime.ubuntu-x86_64": "2.0.0-preview8",
"Imageflow.NativeRuntime.win-x86": "2.0.0-preview8",
"Imageflow.NativeRuntime.win-x86_64": "2.0.0-preview8",
"Imageflow.Net": "0.13.0"
"Imageflow.Net": "0.13.1"
}
},
"Imageflow.NativeRuntime.osx-x86_64": {
Expand All @@ -41,8 +41,8 @@
},
"Imageflow.Net": {
"type": "Transitive",
"resolved": "0.13.0",
"contentHash": "nH3P2rLt5rNjPnDlCJ2n1qHLloNc0n+Iym8OVqk6neyW7+Gamuo4iuAXm4daQvcr354qD0St28kyl7j66oMC9g==",
"resolved": "0.13.1",
"contentHash": "QHSghMGgiy4DhRloqEgNaaY+AM/28mwSF5Q371B90JyKDGIEtJPYMX+d8AkCmHuuf9Tgc6Zl8v+9ieY5yXGcNw==",
"dependencies": {
"Microsoft.IO.RecyclableMemoryStream": "[3.0.0, 4.0.0)",
"System.Text.Json": "6.0.9"
Expand Down Expand Up @@ -142,7 +142,7 @@
"imageflow.server": {
"type": "Project",
"dependencies": {
"Imageflow.AllPlatforms": "[0.13.0, )",
"Imageflow.AllPlatforms": "[0.13.1, )",
"Imazen.Common": "[0.1.0--notset, )",
"Imazen.Routing": "[0.1.0--notset, )",
"Microsoft.IO.RecyclableMemoryStream": "[3.0.0, )"
Expand All @@ -151,7 +151,9 @@
"imazen.abstractions": {
"type": "Project",
"dependencies": {
"CommunityToolkit.HighPerformance": "[8.*, )",
"Microsoft.Extensions.Hosting.Abstractions": "[2.*, )",
"System.Collections.Immutable": "[6.*, )",
"System.Text.Encodings.Web": "[6.*, )"
}
},
Expand Down
20 changes: 11 additions & 9 deletions src/Imageflow.Server.Configuration/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
},
"Microsoft.NET.ILLink.Tasks": {
"type": "Direct",
"requested": "[8.0.2, )",
"resolved": "8.0.2",
"contentHash": "hKTrehpfVzOhAz0mreaTAZgbz0DrMEbWq4n3hAo8Ks6WdxdqQhNPvzOqn9VygKuWf1bmxPdraqzTaXriO/sn0A=="
"requested": "[8.0.3, )",
"resolved": "8.0.3",
"contentHash": "0kwNg0LBIvVTx9A2mo9Mnw4wLGtaeQgjSz5P13bOOwdWPPLe9HzI+XTkwiMhS7iQCM6X4LAbFR76xScaMw0MrA=="
},
"Microsoft.SourceLink.GitHub": {
"type": "Direct",
Expand All @@ -37,14 +37,14 @@
},
"Imageflow.AllPlatforms": {
"type": "Transitive",
"resolved": "0.13.0",
"contentHash": "IlLfRRfyicRgWTrWApZvFWhJ1vaUNdSxG6qS1Ej/dj9TrKeomJzvB0kqrvci/Rz80TSyxrQX1vWGCL2Dhe8o1Q==",
"resolved": "0.13.1",
"contentHash": "cOuUD9JqwgGqkOwaXe3rjmHdA8F1x1Bqsu4m9x9tgJUGsMqytOeujYHz/trctU+VY8rODoCVw4fStJ8vVELIeQ==",
"dependencies": {
"Imageflow.NativeRuntime.osx-x86_64": "2.0.0-preview8",
"Imageflow.NativeRuntime.ubuntu-x86_64": "2.0.0-preview8",
"Imageflow.NativeRuntime.win-x86": "2.0.0-preview8",
"Imageflow.NativeRuntime.win-x86_64": "2.0.0-preview8",
"Imageflow.Net": "0.13.0"
"Imageflow.Net": "0.13.1"
}
},
"Imageflow.NativeRuntime.osx-x86_64": {
Expand All @@ -69,8 +69,8 @@
},
"Imageflow.Net": {
"type": "Transitive",
"resolved": "0.13.0",
"contentHash": "nH3P2rLt5rNjPnDlCJ2n1qHLloNc0n+Iym8OVqk6neyW7+Gamuo4iuAXm4daQvcr354qD0St28kyl7j66oMC9g==",
"resolved": "0.13.1",
"contentHash": "QHSghMGgiy4DhRloqEgNaaY+AM/28mwSF5Q371B90JyKDGIEtJPYMX+d8AkCmHuuf9Tgc6Zl8v+9ieY5yXGcNw==",
"dependencies": {
"Microsoft.IO.RecyclableMemoryStream": "[3.0.0, 4.0.0)",
"System.Text.Json": "6.0.9"
Expand Down Expand Up @@ -201,7 +201,7 @@
"imageflow.server": {
"type": "Project",
"dependencies": {
"Imageflow.AllPlatforms": "[0.13.0, )",
"Imageflow.AllPlatforms": "[0.13.1, )",
"Imazen.Common": "[0.1.0--notset, )",
"Imazen.Routing": "[0.1.0--notset, )",
"Microsoft.IO.RecyclableMemoryStream": "[3.0.0, )"
Expand All @@ -218,7 +218,9 @@
"imazen.abstractions": {
"type": "Project",
"dependencies": {
"CommunityToolkit.HighPerformance": "[8.*, )",
"Microsoft.Extensions.Hosting.Abstractions": "[2.*, )",
"System.Collections.Immutable": "[6.*, )",
"System.Text.Encodings.Web": "[6.*, )"
}
},
Expand Down
20 changes: 11 additions & 9 deletions src/Imageflow.Server.Host/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
},
"Microsoft.NET.ILLink.Tasks": {
"type": "Direct",
"requested": "[8.0.2, )",
"resolved": "8.0.2",
"contentHash": "hKTrehpfVzOhAz0mreaTAZgbz0DrMEbWq4n3hAo8Ks6WdxdqQhNPvzOqn9VygKuWf1bmxPdraqzTaXriO/sn0A=="
"requested": "[8.0.3, )",
"resolved": "8.0.3",
"contentHash": "0kwNg0LBIvVTx9A2mo9Mnw4wLGtaeQgjSz5P13bOOwdWPPLe9HzI+XTkwiMhS7iQCM6X4LAbFR76xScaMw0MrA=="
},
"AWSSDK.Core": {
"type": "Transitive",
Expand Down Expand Up @@ -103,14 +103,14 @@
},
"Imageflow.AllPlatforms": {
"type": "Transitive",
"resolved": "0.13.0",
"contentHash": "IlLfRRfyicRgWTrWApZvFWhJ1vaUNdSxG6qS1Ej/dj9TrKeomJzvB0kqrvci/Rz80TSyxrQX1vWGCL2Dhe8o1Q==",
"resolved": "0.13.1",
"contentHash": "cOuUD9JqwgGqkOwaXe3rjmHdA8F1x1Bqsu4m9x9tgJUGsMqytOeujYHz/trctU+VY8rODoCVw4fStJ8vVELIeQ==",
"dependencies": {
"Imageflow.NativeRuntime.osx-x86_64": "2.0.0-preview8",
"Imageflow.NativeRuntime.ubuntu-x86_64": "2.0.0-preview8",
"Imageflow.NativeRuntime.win-x86": "2.0.0-preview8",
"Imageflow.NativeRuntime.win-x86_64": "2.0.0-preview8",
"Imageflow.Net": "0.13.0"
"Imageflow.Net": "0.13.1"
}
},
"Imageflow.NativeRuntime.osx-x86_64": {
Expand All @@ -135,8 +135,8 @@
},
"Imageflow.Net": {
"type": "Transitive",
"resolved": "0.13.0",
"contentHash": "nH3P2rLt5rNjPnDlCJ2n1qHLloNc0n+Iym8OVqk6neyW7+Gamuo4iuAXm4daQvcr354qD0St28kyl7j66oMC9g==",
"resolved": "0.13.1",
"contentHash": "QHSghMGgiy4DhRloqEgNaaY+AM/28mwSF5Q371B90JyKDGIEtJPYMX+d8AkCmHuuf9Tgc6Zl8v+9ieY5yXGcNw==",
"dependencies": {
"Microsoft.IO.RecyclableMemoryStream": "[3.0.0, 4.0.0)",
"System.Text.Json": "6.0.9"
Expand Down Expand Up @@ -428,7 +428,7 @@
"imageflow.server": {
"type": "Project",
"dependencies": {
"Imageflow.AllPlatforms": "[0.13.0, )",
"Imageflow.AllPlatforms": "[0.13.1, )",
"Imazen.Common": "[0.1.0--notset, )",
"Imazen.Routing": "[0.1.0--notset, )",
"Microsoft.IO.RecyclableMemoryStream": "[3.0.0, )"
Expand Down Expand Up @@ -477,7 +477,9 @@
"imazen.abstractions": {
"type": "Project",
"dependencies": {
"CommunityToolkit.HighPerformance": "[8.*, )",
"Microsoft.Extensions.Hosting.Abstractions": "[2.*, )",
"System.Collections.Immutable": "[6.*, )",
"System.Text.Encodings.Web": "[6.*, )"
}
},
Expand Down
3 changes: 2 additions & 1 deletion src/Imageflow.Server.HybridCache/HybridCacheService.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using Imazen.Abstractions.BlobCache;
using Imazen.Abstractions.Logging;
using Imazen.Common.Issues;
using Microsoft.Extensions.Hosting;

namespace Imageflow.Server.HybridCache
{
public class HybridCacheService : IBlobCacheProvider
public class HybridCacheService : IBlobCacheProvider, IHostedService
{
private readonly List<HybridNamedCache> namedCaches = new List<HybridNamedCache>();
public HybridCacheService(IEnumerable<HybridCacheOptions> namedCacheConfigurations, IReLoggerFactory loggerFactory)
Expand Down
18 changes: 18 additions & 0 deletions src/Imageflow.Server.HybridCache/HybridCacheServiceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,30 @@
using Imazen.Abstractions.Logging;
using Imazen.Common.Extensibility.Support;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace Imageflow.Server.HybridCache
{
public static class HybridCacheServiceExtensions
{

// public static IServiceCollection AddImageflowHybridCache(this IServiceCollection services, HybridCacheOptions options)
// {
// services.AddImageflowReLogStoreAndReLoggerFactoryIfMissing();
//
// HybridCacheService? captured = null;
// services.AddSingleton<IBlobCacheProvider>((container) =>
// {
// var loggerFactory = container.GetRequiredService<IReLoggerFactory>();
// captured = new HybridCacheService(options, loggerFactory);
// return captured;
// });
// services.AddSingleton<IHostedService>(container => (IHostedService)container.GetServices<IBlobCacheProvider>().Where(c => c == captured).Single()
//
// services.AddHostedService<HostedServiceProxy<IBlobCacheProvider>>();
// return services;
// }


public static IServiceCollection AddImageflowHybridCache(this IServiceCollection services, HybridCacheOptions options)
{
Expand Down
Loading

0 comments on commit c3ce0bd

Please sign in to comment.