Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a533f25
Merge pull request #40 from geeklearningio/master
asiffermann Mar 30, 2017
6fee6cf
VS 2017 migration
asiffermann Mar 30, 2017
10c2799
Merge pull request #43 from geeklearningio/feature/vs2017-migration
asiffermann Mar 30, 2017
d17d670
Strongly typed configuration for providers and scopes, proper excepti…
asiffermann Mar 30, 2017
d6139ad
New configuration
asiffermann Apr 12, 2017
989f7be
ConnectionStringName parameter mapping
asiffermann Apr 13, 2017
1ed9fc6
Fix tests (randomize Azure container names)
asiffermann Apr 13, 2017
308a3eb
ScopedStores and Init stores
asiffermann Apr 13, 2017
cf5d398
Check new AccessLevel parameter in FileSystem.Server
asiffermann Apr 13, 2017
e6a290e
Update framework packages and fix sample project
asiffermann May 19, 2017
73f50c0
Validate options
asiffermann May 19, 2017
bd66261
Update Readme.md
asiffermann May 19, 2017
74093c4
Merge pull request #44 from geeklearningio/feature/enhanced-configura…
asiffermann May 19, 2017
f524cc6
Shared Access abstractions
asiffermann May 23, 2017
cfe91a9
Azure Metadata encoding
asiffermann May 23, 2017
57755f7
Merge pull request #49 from geeklearningio/feature/encode-metadata
asiffermann May 23, 2017
9acc1e1
Shared Access abstractions
asiffermann May 23, 2017
9611a14
Merge branch 'feature/secure-urls' of https://github.com/geeklearning…
asiffermann May 23, 2017
48cd906
Secured Urls for Azure Storage
asiffermann May 30, 2017
e6fa8b5
Merge pull request #50 from geeklearningio/feature/secure-urls
asiffermann May 30, 2017
55fb667
Generalized async return types
asiffermann May 30, 2017
07a1c1f
Merge pull request #51 from geeklearningio/feature/value-tasks
asiffermann May 30, 2017
e6fb6e6
Fetch properties on an existing file reference
asiffermann May 30, 2017
87392e6
Merge pull request #52 from geeklearningio/feature/fetch-properties
asiffermann May 30, 2017
183e0f2
Add ContentMD5 property exposure and new Overwrite Policies when savi…
asiffermann Jun 8, 2017
6654601
Merge pull request #54 from geeklearningio/feature/overwrite-policy
asiffermann Jun 8, 2017
ef63b9c
Update README.md
arnaudauroux Jun 13, 2017
7e4c16c
Merge pull request #55 from geeklearningio/arnaudauroux-patch-1
arnaudauroux Jun 13, 2017
9a2370e
Update README.md
arnaudauroux Jun 13, 2017
dba0803
Merge pull request #56 from geeklearningio/arnaudauroux-patch-1
arnaudauroux Jun 13, 2017
cd19d2d
Fix azure store upload condition
arnaudauroux Jun 13, 2017
91fd159
Merge pull request #57 from geeklearningio/feature/fix-blob-upload-co…
arnaudauroux Jun 13, 2017
447aee6
Update README.md
arnaudauroux Jun 13, 2017
21bace7
Merge pull request #59 from geeklearningio/arnaudauroux-patch-2
arnaudauroux Jun 13, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions GeekLearning.Storage.sln
Original file line number Diff line number Diff line change
@@ -1,37 +1,36 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.26228.10
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GeekLearning.Storage", "src\GeekLearning.Storage\GeekLearning.Storage.xproj", "{1F419C53-73C6-4460-B284-6A49AE41C596}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{FBAC4C17-D755-49A9-959D-18FD6B95B543}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GeekLearning.Storage.Azure", "src\GeekLearning.Storage.Azure\GeekLearning.Storage.Azure.xproj", "{FD8BB8F9-9AF5-4C12-B962-9E08C30B01E2}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GeekLearning.Storage.FileSystem", "src\GeekLearning.Storage.FileSystem\GeekLearning.Storage.FileSystem.xproj", "{4A12B042-76B3-471B-9235-F653E1ABE3C0}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GeekLearning.Storage.BasicSample", "samples\GeekLearning.Storage.BasicSample\GeekLearning.Storage.BasicSample.xproj", "{63416AEA-DA51-4D62-B566-DB7D9BC800DC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{2DAF5EF9-8F8E-4C51-BE2D-8D63CA143360}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "items", "items", "{6BEB33C6-FA17-4F58-ACC3-83C1EB28B604}"
ProjectSection(SolutionItems) = preProject
.gitattributes = .gitattributes
.gitignore = .gitignore
GitVersion.yml = GitVersion.yml
global.json = global.json
LICENSE.md = LICENSE.md
README.md = README.md
EndProjectSection
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GeekLearning.Storage.FileSystem.Server", "src\GeekLearning.Storage.FileSystem.Server\GeekLearning.Storage.FileSystem.Server.xproj", "{9D94CD6C-9451-449A-BED2-1C07D624A8E0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{520AB1D3-C501-40FD-ACEB-7CC0D1F00B90}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GeekLearning.Storage.Integration.Test", "tests\GeekLearning.Storage.Integration.Test\GeekLearning.Storage.Integration.Test.xproj", "{590B21B0-2AFA-4329-82AD-EF180C50EB5C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeekLearning.Storage", "src\GeekLearning.Storage\GeekLearning.Storage.csproj", "{1F419C53-73C6-4460-B284-6A49AE41C596}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeekLearning.Storage.Azure", "src\GeekLearning.Storage.Azure\GeekLearning.Storage.Azure.csproj", "{FD8BB8F9-9AF5-4C12-B962-9E08C30B01E2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeekLearning.Storage.FileSystem", "src\GeekLearning.Storage.FileSystem\GeekLearning.Storage.FileSystem.csproj", "{4A12B042-76B3-471B-9235-F653E1ABE3C0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeekLearning.Storage.BasicSample", "samples\GeekLearning.Storage.BasicSample\GeekLearning.Storage.BasicSample.csproj", "{63416AEA-DA51-4D62-B566-DB7D9BC800DC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeekLearning.Storage.FileSystem.Server", "src\GeekLearning.Storage.FileSystem.Server\GeekLearning.Storage.FileSystem.Server.csproj", "{9D94CD6C-9451-449A-BED2-1C07D624A8E0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeekLearning.Storage.Integration.Test", "tests\GeekLearning.Storage.Integration.Test\GeekLearning.Storage.Integration.Test.csproj", "{590B21B0-2AFA-4329-82AD-EF180C50EB5C}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GeekLearning.Storage.FileSystem.ExtendedProperties.FileSystem", "src\GeekLearning.Storage.FileSystem.ExtendedProperties.FileSystem\GeekLearning.Storage.FileSystem.ExtendedProperties.FileSystem.xproj", "{8C02EBBE-9EC8-4F47-9464-5A94BDE25A8F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeekLearning.Storage.FileSystem.ExtendedProperties.FileSystem", "src\GeekLearning.Storage.FileSystem.ExtendedProperties.FileSystem\GeekLearning.Storage.FileSystem.ExtendedProperties.FileSystem.csproj", "{8C02EBBE-9EC8-4F47-9464-5A94BDE25A8F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
[![NuGet Version](http://img.shields.io/nuget/v/GeekLearning.Storage.svg?style=flat-square&label=nuget:%20primitives)](https://www.nuget.org/packages/GeekLearning.Storage/)
[![NuGet Version](http://img.shields.io/nuget/v/GeekLearning.Storage.FileSystem.svg?style=flat-square&label=nuget:%20filesystem)](https://www.nuget.org/packages/GeekLearning.Storage.FileSystem/)
[![NuGet Version](http://img.shields.io/nuget/v/GeekLearning.Storage.Azure.svg?style=flat-square&label=nuget:%20azure%20 storage)](https://www.nuget.org/packages/GeekLearning.Storage.Azure/)
[![NuGet Version](http://img.shields.io/nuget/v/GeekLearning.Storage.svg?style=flat-square&label=NuGet)](https://www.nuget.org/packages/GeekLearning.Storage/)
[![Build Status](https://geeklearning.visualstudio.com/_apis/public/build/definitions/f841b266-7595-4d01-9ee1-4864cf65aa73/27/badge)](#)

# Geek Learning Cloud Storage Abstraction

This library abstracts physical data storage in a way which allows you to transparently switch the underlying provider
by configuration.

Expand All @@ -26,3 +24,4 @@ We don't support for Amazon S3, but it is one of our high priority objective.

You can head to our introduction [blog post](http://geeklearning.io/dotnet-core-storage-cloud-or-file-system-storage-made-easy/),
or to the [wiki](https://github.com/geeklearningio/gl-dotnet-storage/wiki).

6 changes: 0 additions & 6 deletions global.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ public SampleController(IStorageFactory storageFactory)
}

[HttpGet]
public async Task<IEnumerable<string>> Get()
public async ValueTask<IEnumerable<string>> Get()
{
var summaries = await this.sharedAssets.ListAsync("summaries", "*.txt", recursive: true, withMetadata: false);
return summaries.Select(x => x.Path);
}

[HttpGet]
public async Task<string> Get(string path)
public async ValueTask<string> Get(string path)
{
var summary = await this.sharedAssets.GetAsync(path);
return await summary.ReadAllTextAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public ValuesController(TemplatesStore templates)
}

[HttpGet]
public async Task<IEnumerable<string>> Get()
public async ValueTask<IEnumerable<string>> Get()
{
return new string[] { await templates.Store.ReadAllTextAsync("json.json"), "value2" };
}

[HttpGet("files")]
public async Task<IEnumerable<string>> Get(int id)
public async ValueTask<IEnumerable<string>> Get(int id)
{
var files = await templates.Store.ListAsync("");
return files.Select(x => x.PublicUrl);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>GeekLearning.Storage.BasicSample</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>GeekLearning.Storage.BasicSample</PackageId>
<RuntimeFrameworkVersion>1.1.2</RuntimeFrameworkVersion>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8</PackageTargetFallback>
</PropertyGroup>

<ItemGroup>
<None Update="Views;Templates\**\*">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</None>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\GeekLearning.Storage\GeekLearning.Storage.csproj" />
<ProjectReference Include="..\..\src\GeekLearning.Storage.Azure\GeekLearning.Storage.Azure.csproj" />
<ProjectReference Include="..\..\src\GeekLearning.Storage.FileSystem\GeekLearning.Storage.FileSystem.csproj" />
<ProjectReference Include="..\..\src\GeekLearning.Storage.FileSystem.Server\GeekLearning.Storage.FileSystem.Server.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Options" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.2" />
</ItemGroup>

</Project>

This file was deleted.

7 changes: 3 additions & 4 deletions samples/GeekLearning.Storage.BasicSample/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ public void ConfigureServices(IServiceCollection services)
byte[] signingKey = new byte[512];
rng.GetBytes(signingKey);

services.AddStorage()
services.AddStorage(this.Configuration.GetSection("Storage"))
.AddAzureStorage()
.AddFileSystemStorage(HostingEnvironement.ContentRootPath)
.AddFileSystemStorageServer(options=> {
.AddFileSystemStorageServer(options =>
{
options.SigningKey = signingKey;
options.BaseUri = new Uri("http://localhost:11149/");
});

services.Configure<StorageOptions>(Configuration.GetSection("Storage"));

services.AddScoped<TemplatesStore>();
}
Expand Down
7 changes: 2 additions & 5 deletions samples/GeekLearning.Storage.BasicSample/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@
"Storage": {
"Stores": {
"Templates": {
"Provider": "FileSystem",
"Parameters": {
"Path": "Templates",
"Access" : "Public"
}
"ProviderType": "FileSystem",
"AccessLevel": "Public"
}
}
}
Expand Down
61 changes: 0 additions & 61 deletions samples/GeekLearning.Storage.BasicSample/project.json

This file was deleted.

10 changes: 10 additions & 0 deletions src/GeekLearning.Storage.Azure/AzureStorageExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
namespace GeekLearning.Storage
{
using Azure;
using GeekLearning.Storage.Azure.Configuration;
using GeekLearning.Storage.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options;

public static class AzureStorageExtensions
{
public static IServiceCollection AddAzureStorage(this IServiceCollection services)
{
return services
.AddSingleton<IConfigureOptions<AzureParsedOptions>, ConfigureProviderOptions<AzureParsedOptions, AzureProviderInstanceOptions, AzureStoreOptions, AzureScopedStoreOptions>>()
.AddAzureStorageServices();
}

private static IServiceCollection AddAzureStorageServices(this IServiceCollection services)
{
services.TryAddEnumerable(ServiceDescriptor.Transient<IStorageProvider, AzureStorageProvider>());
return services;
Expand Down
16 changes: 0 additions & 16 deletions src/GeekLearning.Storage.Azure/AzureStorageManagerOptions.cs

This file was deleted.

18 changes: 14 additions & 4 deletions src/GeekLearning.Storage.Azure/AzureStorageProvider.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
namespace GeekLearning.Storage.Azure
{
using GeekLearning.Storage.Azure.Configuration;
using GeekLearning.Storage.Internal;
using Microsoft.Extensions.Options;
using Storage;

public class AzureStorageProvider : IStorageProvider
public class AzureStorageProvider : StorageProviderBase<AzureParsedOptions, AzureProviderInstanceOptions, AzureStoreOptions, AzureScopedStoreOptions>
{
public string Name => "Azure";
public const string ProviderName = "Azure";

public IStore BuildStore(string storeName, IStorageStoreOptions storeOptions)
public AzureStorageProvider(IOptions<AzureParsedOptions> options)
: base(options)
{
return new AzureStore(storeName, storeOptions.Parameters["ConnectionString"], storeOptions.Parameters["Container"]);
}

public override string Name => ProviderName;

protected override IStore BuildStoreInternal(string storeName, AzureStoreOptions storeOptions)
{
return new AzureStore(storeOptions);
}
}
}
Loading