Skip to content

Commit

Permalink
Merge pull request #61 from geeklearningio/release/0.7.0
Browse files Browse the repository at this point in the history
Release/0.7.0
  • Loading branch information
asiffermann authored Oct 2, 2017
2 parents 6ec78fc + 21bace7 commit c9dc2c8
Show file tree
Hide file tree
Showing 109 changed files with 2,023 additions and 965 deletions.
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

0 comments on commit c9dc2c8

Please sign in to comment.