Skip to content

Commit c3ce0bd

Browse files
committed
Refactor BlobWrapper design to accomodate disposal and reference tracking requirements.
1 parent cde118f commit c3ce0bd

File tree

73 files changed

+1704
-855
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1704
-855
lines changed

examples/Imageflow.Server.Example/CustomBlobService.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public async Task<CodeResult<IBlobWrapper>> Fetch(string virtualPath)
132132
}
133133
internal static class CustomAzureBlobHelpers
134134
{
135-
public static IConsumableBlob CreateAzureBlob(Response<BlobDownloadInfo> response)
135+
public static StreamBlob CreateAzureBlob(Response<BlobDownloadInfo> response)
136136
{
137137
var a = new BlobAttributes()
138138
{
@@ -142,7 +142,7 @@ public static IConsumableBlob CreateAzureBlob(Response<BlobDownloadInfo> respons
142142

143143
};
144144
var stream = response.Value.Content;
145-
return new ConsumableStreamBlob(a, stream);
145+
return new StreamBlob(a, stream);
146146
}
147147
}
148148
}

examples/Imageflow.Server.Example/packages.lock.json

+16-12
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@
9191
},
9292
"Imageflow.AllPlatforms": {
9393
"type": "Transitive",
94-
"resolved": "0.13.0",
95-
"contentHash": "IlLfRRfyicRgWTrWApZvFWhJ1vaUNdSxG6qS1Ej/dj9TrKeomJzvB0kqrvci/Rz80TSyxrQX1vWGCL2Dhe8o1Q==",
94+
"resolved": "0.13.1",
95+
"contentHash": "cOuUD9JqwgGqkOwaXe3rjmHdA8F1x1Bqsu4m9x9tgJUGsMqytOeujYHz/trctU+VY8rODoCVw4fStJ8vVELIeQ==",
9696
"dependencies": {
9797
"Imageflow.NativeRuntime.osx-x86_64": "2.0.0-preview8",
9898
"Imageflow.NativeRuntime.ubuntu-x86_64": "2.0.0-preview8",
9999
"Imageflow.NativeRuntime.win-x86": "2.0.0-preview8",
100100
"Imageflow.NativeRuntime.win-x86_64": "2.0.0-preview8",
101-
"Imageflow.Net": "0.13.0"
101+
"Imageflow.Net": "0.13.1"
102102
}
103103
},
104104
"Imageflow.NativeRuntime.osx-x86_64": {
@@ -123,8 +123,8 @@
123123
},
124124
"Imageflow.Net": {
125125
"type": "Transitive",
126-
"resolved": "0.13.0",
127-
"contentHash": "nH3P2rLt5rNjPnDlCJ2n1qHLloNc0n+Iym8OVqk6neyW7+Gamuo4iuAXm4daQvcr354qD0St28kyl7j66oMC9g==",
126+
"resolved": "0.13.1",
127+
"contentHash": "QHSghMGgiy4DhRloqEgNaaY+AM/28mwSF5Q371B90JyKDGIEtJPYMX+d8AkCmHuuf9Tgc6Zl8v+9ieY5yXGcNw==",
128128
"dependencies": {
129129
"Microsoft.IO.RecyclableMemoryStream": "[3.0.0, 4.0.0)",
130130
"System.Text.Json": "6.0.9"
@@ -411,7 +411,7 @@
411411
"imageflow.server": {
412412
"type": "Project",
413413
"dependencies": {
414-
"Imageflow.AllPlatforms": "[0.13.0, )",
414+
"Imageflow.AllPlatforms": "[0.13.1, )",
415415
"Imazen.Common": "[0.1.0--notset, )",
416416
"Imazen.Routing": "[0.1.0--notset, )",
417417
"Microsoft.IO.RecyclableMemoryStream": "[3.0.0, )"
@@ -451,7 +451,9 @@
451451
"imazen.abstractions": {
452452
"type": "Project",
453453
"dependencies": {
454+
"CommunityToolkit.HighPerformance": "[8.*, )",
454455
"Microsoft.Extensions.Hosting.Abstractions": "[2.*, )",
456+
"System.Collections.Immutable": "[6.*, )",
455457
"System.Text.Encodings.Web": "[6.*, )"
456458
}
457459
},
@@ -571,14 +573,14 @@
571573
},
572574
"Imageflow.AllPlatforms": {
573575
"type": "Transitive",
574-
"resolved": "0.13.0",
575-
"contentHash": "IlLfRRfyicRgWTrWApZvFWhJ1vaUNdSxG6qS1Ej/dj9TrKeomJzvB0kqrvci/Rz80TSyxrQX1vWGCL2Dhe8o1Q==",
576+
"resolved": "0.13.1",
577+
"contentHash": "cOuUD9JqwgGqkOwaXe3rjmHdA8F1x1Bqsu4m9x9tgJUGsMqytOeujYHz/trctU+VY8rODoCVw4fStJ8vVELIeQ==",
576578
"dependencies": {
577579
"Imageflow.NativeRuntime.osx-x86_64": "2.0.0-preview8",
578580
"Imageflow.NativeRuntime.ubuntu-x86_64": "2.0.0-preview8",
579581
"Imageflow.NativeRuntime.win-x86": "2.0.0-preview8",
580582
"Imageflow.NativeRuntime.win-x86_64": "2.0.0-preview8",
581-
"Imageflow.Net": "0.13.0"
583+
"Imageflow.Net": "0.13.1"
582584
}
583585
},
584586
"Imageflow.NativeRuntime.osx-x86_64": {
@@ -603,8 +605,8 @@
603605
},
604606
"Imageflow.Net": {
605607
"type": "Transitive",
606-
"resolved": "0.13.0",
607-
"contentHash": "nH3P2rLt5rNjPnDlCJ2n1qHLloNc0n+Iym8OVqk6neyW7+Gamuo4iuAXm4daQvcr354qD0St28kyl7j66oMC9g==",
608+
"resolved": "0.13.1",
609+
"contentHash": "QHSghMGgiy4DhRloqEgNaaY+AM/28mwSF5Q371B90JyKDGIEtJPYMX+d8AkCmHuuf9Tgc6Zl8v+9ieY5yXGcNw==",
608610
"dependencies": {
609611
"Microsoft.IO.RecyclableMemoryStream": "[3.0.0, 4.0.0)",
610612
"System.Text.Json": "6.0.9"
@@ -891,7 +893,7 @@
891893
"imageflow.server": {
892894
"type": "Project",
893895
"dependencies": {
894-
"Imageflow.AllPlatforms": "[0.13.0, )",
896+
"Imageflow.AllPlatforms": "[0.13.1, )",
895897
"Imazen.Common": "[0.1.0--notset, )",
896898
"Imazen.Routing": "[0.1.0--notset, )",
897899
"Microsoft.IO.RecyclableMemoryStream": "[3.0.0, )"
@@ -931,7 +933,9 @@
931933
"imazen.abstractions": {
932934
"type": "Project",
933935
"dependencies": {
936+
"CommunityToolkit.HighPerformance": "[8.*, )",
934937
"Microsoft.Extensions.Hosting.Abstractions": "[2.*, )",
938+
"System.Collections.Immutable": "[6.*, )",
935939
"System.Text.Encodings.Web": "[6.*, )"
936940
}
937941
},

examples/Imageflow.Server.ExampleMinimal/packages.lock.json

+8-6
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
},
1010
"Imageflow.AllPlatforms": {
1111
"type": "Transitive",
12-
"resolved": "0.13.0",
13-
"contentHash": "IlLfRRfyicRgWTrWApZvFWhJ1vaUNdSxG6qS1Ej/dj9TrKeomJzvB0kqrvci/Rz80TSyxrQX1vWGCL2Dhe8o1Q==",
12+
"resolved": "0.13.1",
13+
"contentHash": "cOuUD9JqwgGqkOwaXe3rjmHdA8F1x1Bqsu4m9x9tgJUGsMqytOeujYHz/trctU+VY8rODoCVw4fStJ8vVELIeQ==",
1414
"dependencies": {
1515
"Imageflow.NativeRuntime.osx-x86_64": "2.0.0-preview8",
1616
"Imageflow.NativeRuntime.ubuntu-x86_64": "2.0.0-preview8",
1717
"Imageflow.NativeRuntime.win-x86": "2.0.0-preview8",
1818
"Imageflow.NativeRuntime.win-x86_64": "2.0.0-preview8",
19-
"Imageflow.Net": "0.13.0"
19+
"Imageflow.Net": "0.13.1"
2020
}
2121
},
2222
"Imageflow.NativeRuntime.osx-x86_64": {
@@ -41,8 +41,8 @@
4141
},
4242
"Imageflow.Net": {
4343
"type": "Transitive",
44-
"resolved": "0.13.0",
45-
"contentHash": "nH3P2rLt5rNjPnDlCJ2n1qHLloNc0n+Iym8OVqk6neyW7+Gamuo4iuAXm4daQvcr354qD0St28kyl7j66oMC9g==",
44+
"resolved": "0.13.1",
45+
"contentHash": "QHSghMGgiy4DhRloqEgNaaY+AM/28mwSF5Q371B90JyKDGIEtJPYMX+d8AkCmHuuf9Tgc6Zl8v+9ieY5yXGcNw==",
4646
"dependencies": {
4747
"Microsoft.IO.RecyclableMemoryStream": "[3.0.0, 4.0.0)",
4848
"System.Text.Json": "6.0.9"
@@ -142,7 +142,7 @@
142142
"imageflow.server": {
143143
"type": "Project",
144144
"dependencies": {
145-
"Imageflow.AllPlatforms": "[0.13.0, )",
145+
"Imageflow.AllPlatforms": "[0.13.1, )",
146146
"Imazen.Common": "[0.1.0--notset, )",
147147
"Imazen.Routing": "[0.1.0--notset, )",
148148
"Microsoft.IO.RecyclableMemoryStream": "[3.0.0, )"
@@ -151,7 +151,9 @@
151151
"imazen.abstractions": {
152152
"type": "Project",
153153
"dependencies": {
154+
"CommunityToolkit.HighPerformance": "[8.*, )",
154155
"Microsoft.Extensions.Hosting.Abstractions": "[2.*, )",
156+
"System.Collections.Immutable": "[6.*, )",
155157
"System.Text.Encodings.Web": "[6.*, )"
156158
}
157159
},

src/Imageflow.Server.Configuration/packages.lock.json

+11-9
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
},
1111
"Microsoft.NET.ILLink.Tasks": {
1212
"type": "Direct",
13-
"requested": "[8.0.2, )",
14-
"resolved": "8.0.2",
15-
"contentHash": "hKTrehpfVzOhAz0mreaTAZgbz0DrMEbWq4n3hAo8Ks6WdxdqQhNPvzOqn9VygKuWf1bmxPdraqzTaXriO/sn0A=="
13+
"requested": "[8.0.3, )",
14+
"resolved": "8.0.3",
15+
"contentHash": "0kwNg0LBIvVTx9A2mo9Mnw4wLGtaeQgjSz5P13bOOwdWPPLe9HzI+XTkwiMhS7iQCM6X4LAbFR76xScaMw0MrA=="
1616
},
1717
"Microsoft.SourceLink.GitHub": {
1818
"type": "Direct",
@@ -37,14 +37,14 @@
3737
},
3838
"Imageflow.AllPlatforms": {
3939
"type": "Transitive",
40-
"resolved": "0.13.0",
41-
"contentHash": "IlLfRRfyicRgWTrWApZvFWhJ1vaUNdSxG6qS1Ej/dj9TrKeomJzvB0kqrvci/Rz80TSyxrQX1vWGCL2Dhe8o1Q==",
40+
"resolved": "0.13.1",
41+
"contentHash": "cOuUD9JqwgGqkOwaXe3rjmHdA8F1x1Bqsu4m9x9tgJUGsMqytOeujYHz/trctU+VY8rODoCVw4fStJ8vVELIeQ==",
4242
"dependencies": {
4343
"Imageflow.NativeRuntime.osx-x86_64": "2.0.0-preview8",
4444
"Imageflow.NativeRuntime.ubuntu-x86_64": "2.0.0-preview8",
4545
"Imageflow.NativeRuntime.win-x86": "2.0.0-preview8",
4646
"Imageflow.NativeRuntime.win-x86_64": "2.0.0-preview8",
47-
"Imageflow.Net": "0.13.0"
47+
"Imageflow.Net": "0.13.1"
4848
}
4949
},
5050
"Imageflow.NativeRuntime.osx-x86_64": {
@@ -69,8 +69,8 @@
6969
},
7070
"Imageflow.Net": {
7171
"type": "Transitive",
72-
"resolved": "0.13.0",
73-
"contentHash": "nH3P2rLt5rNjPnDlCJ2n1qHLloNc0n+Iym8OVqk6neyW7+Gamuo4iuAXm4daQvcr354qD0St28kyl7j66oMC9g==",
72+
"resolved": "0.13.1",
73+
"contentHash": "QHSghMGgiy4DhRloqEgNaaY+AM/28mwSF5Q371B90JyKDGIEtJPYMX+d8AkCmHuuf9Tgc6Zl8v+9ieY5yXGcNw==",
7474
"dependencies": {
7575
"Microsoft.IO.RecyclableMemoryStream": "[3.0.0, 4.0.0)",
7676
"System.Text.Json": "6.0.9"
@@ -201,7 +201,7 @@
201201
"imageflow.server": {
202202
"type": "Project",
203203
"dependencies": {
204-
"Imageflow.AllPlatforms": "[0.13.0, )",
204+
"Imageflow.AllPlatforms": "[0.13.1, )",
205205
"Imazen.Common": "[0.1.0--notset, )",
206206
"Imazen.Routing": "[0.1.0--notset, )",
207207
"Microsoft.IO.RecyclableMemoryStream": "[3.0.0, )"
@@ -218,7 +218,9 @@
218218
"imazen.abstractions": {
219219
"type": "Project",
220220
"dependencies": {
221+
"CommunityToolkit.HighPerformance": "[8.*, )",
221222
"Microsoft.Extensions.Hosting.Abstractions": "[2.*, )",
223+
"System.Collections.Immutable": "[6.*, )",
222224
"System.Text.Encodings.Web": "[6.*, )"
223225
}
224226
},

src/Imageflow.Server.Host/packages.lock.json

+11-9
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
},
3434
"Microsoft.NET.ILLink.Tasks": {
3535
"type": "Direct",
36-
"requested": "[8.0.2, )",
37-
"resolved": "8.0.2",
38-
"contentHash": "hKTrehpfVzOhAz0mreaTAZgbz0DrMEbWq4n3hAo8Ks6WdxdqQhNPvzOqn9VygKuWf1bmxPdraqzTaXriO/sn0A=="
36+
"requested": "[8.0.3, )",
37+
"resolved": "8.0.3",
38+
"contentHash": "0kwNg0LBIvVTx9A2mo9Mnw4wLGtaeQgjSz5P13bOOwdWPPLe9HzI+XTkwiMhS7iQCM6X4LAbFR76xScaMw0MrA=="
3939
},
4040
"AWSSDK.Core": {
4141
"type": "Transitive",
@@ -103,14 +103,14 @@
103103
},
104104
"Imageflow.AllPlatforms": {
105105
"type": "Transitive",
106-
"resolved": "0.13.0",
107-
"contentHash": "IlLfRRfyicRgWTrWApZvFWhJ1vaUNdSxG6qS1Ej/dj9TrKeomJzvB0kqrvci/Rz80TSyxrQX1vWGCL2Dhe8o1Q==",
106+
"resolved": "0.13.1",
107+
"contentHash": "cOuUD9JqwgGqkOwaXe3rjmHdA8F1x1Bqsu4m9x9tgJUGsMqytOeujYHz/trctU+VY8rODoCVw4fStJ8vVELIeQ==",
108108
"dependencies": {
109109
"Imageflow.NativeRuntime.osx-x86_64": "2.0.0-preview8",
110110
"Imageflow.NativeRuntime.ubuntu-x86_64": "2.0.0-preview8",
111111
"Imageflow.NativeRuntime.win-x86": "2.0.0-preview8",
112112
"Imageflow.NativeRuntime.win-x86_64": "2.0.0-preview8",
113-
"Imageflow.Net": "0.13.0"
113+
"Imageflow.Net": "0.13.1"
114114
}
115115
},
116116
"Imageflow.NativeRuntime.osx-x86_64": {
@@ -135,8 +135,8 @@
135135
},
136136
"Imageflow.Net": {
137137
"type": "Transitive",
138-
"resolved": "0.13.0",
139-
"contentHash": "nH3P2rLt5rNjPnDlCJ2n1qHLloNc0n+Iym8OVqk6neyW7+Gamuo4iuAXm4daQvcr354qD0St28kyl7j66oMC9g==",
138+
"resolved": "0.13.1",
139+
"contentHash": "QHSghMGgiy4DhRloqEgNaaY+AM/28mwSF5Q371B90JyKDGIEtJPYMX+d8AkCmHuuf9Tgc6Zl8v+9ieY5yXGcNw==",
140140
"dependencies": {
141141
"Microsoft.IO.RecyclableMemoryStream": "[3.0.0, 4.0.0)",
142142
"System.Text.Json": "6.0.9"
@@ -428,7 +428,7 @@
428428
"imageflow.server": {
429429
"type": "Project",
430430
"dependencies": {
431-
"Imageflow.AllPlatforms": "[0.13.0, )",
431+
"Imageflow.AllPlatforms": "[0.13.1, )",
432432
"Imazen.Common": "[0.1.0--notset, )",
433433
"Imazen.Routing": "[0.1.0--notset, )",
434434
"Microsoft.IO.RecyclableMemoryStream": "[3.0.0, )"
@@ -477,7 +477,9 @@
477477
"imazen.abstractions": {
478478
"type": "Project",
479479
"dependencies": {
480+
"CommunityToolkit.HighPerformance": "[8.*, )",
480481
"Microsoft.Extensions.Hosting.Abstractions": "[2.*, )",
482+
"System.Collections.Immutable": "[6.*, )",
481483
"System.Text.Encodings.Web": "[6.*, )"
482484
}
483485
},

src/Imageflow.Server.HybridCache/HybridCacheService.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
using Imazen.Abstractions.BlobCache;
22
using Imazen.Abstractions.Logging;
33
using Imazen.Common.Issues;
4+
using Microsoft.Extensions.Hosting;
45

56
namespace Imageflow.Server.HybridCache
67
{
7-
public class HybridCacheService : IBlobCacheProvider
8+
public class HybridCacheService : IBlobCacheProvider, IHostedService
89
{
910
private readonly List<HybridNamedCache> namedCaches = new List<HybridNamedCache>();
1011
public HybridCacheService(IEnumerable<HybridCacheOptions> namedCacheConfigurations, IReLoggerFactory loggerFactory)

src/Imageflow.Server.HybridCache/HybridCacheServiceExtensions.cs

+18
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,30 @@
22
using Imazen.Abstractions.Logging;
33
using Imazen.Common.Extensibility.Support;
44
using Microsoft.Extensions.DependencyInjection;
5+
using Microsoft.Extensions.Hosting;
56

67
namespace Imageflow.Server.HybridCache
78
{
89
public static class HybridCacheServiceExtensions
910
{
1011

12+
// public static IServiceCollection AddImageflowHybridCache(this IServiceCollection services, HybridCacheOptions options)
13+
// {
14+
// services.AddImageflowReLogStoreAndReLoggerFactoryIfMissing();
15+
//
16+
// HybridCacheService? captured = null;
17+
// services.AddSingleton<IBlobCacheProvider>((container) =>
18+
// {
19+
// var loggerFactory = container.GetRequiredService<IReLoggerFactory>();
20+
// captured = new HybridCacheService(options, loggerFactory);
21+
// return captured;
22+
// });
23+
// services.AddSingleton<IHostedService>(container => (IHostedService)container.GetServices<IBlobCacheProvider>().Where(c => c == captured).Single()
24+
//
25+
// services.AddHostedService<HostedServiceProxy<IBlobCacheProvider>>();
26+
// return services;
27+
// }
28+
1129

1230
public static IServiceCollection AddImageflowHybridCache(this IServiceCollection services, HybridCacheOptions options)
1331
{

0 commit comments

Comments
 (0)