Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -243,4 +243,4 @@ ModelManifest.xml

# FAKE - F# Make
.fake/
/tests/GeekLearning.Integration.Test/appsettings.development.json
appsettings.development.json
21 changes: 14 additions & 7 deletions GeekLearning.Storage.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GeekLearning.Storage.BasicS
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{2DAF5EF9-8F8E-4C51-BE2D-8D63CA143360}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GeekLearning.Integration.Test", "tests\GeekLearning.Integration.Test\GeekLearning.Integration.Test.xproj", "{590B21B0-2AFA-4329-82AD-EF180C50EB5C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "items", "items", "{6BEB33C6-FA17-4F58-ACC3-83C1EB28B604}"
ProjectSection(SolutionItems) = preProject
.gitattributes = .gitattributes
Expand All @@ -31,6 +29,10 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GeekLearning.Storage.FileSy
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}"
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}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -53,14 +55,18 @@ Global
{63416AEA-DA51-4D62-B566-DB7D9BC800DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{63416AEA-DA51-4D62-B566-DB7D9BC800DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{63416AEA-DA51-4D62-B566-DB7D9BC800DC}.Release|Any CPU.Build.0 = Release|Any CPU
{590B21B0-2AFA-4329-82AD-EF180C50EB5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{590B21B0-2AFA-4329-82AD-EF180C50EB5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{590B21B0-2AFA-4329-82AD-EF180C50EB5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{590B21B0-2AFA-4329-82AD-EF180C50EB5C}.Release|Any CPU.Build.0 = Release|Any CPU
{9D94CD6C-9451-449A-BED2-1C07D624A8E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9D94CD6C-9451-449A-BED2-1C07D624A8E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9D94CD6C-9451-449A-BED2-1C07D624A8E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9D94CD6C-9451-449A-BED2-1C07D624A8E0}.Release|Any CPU.Build.0 = Release|Any CPU
{590B21B0-2AFA-4329-82AD-EF180C50EB5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{590B21B0-2AFA-4329-82AD-EF180C50EB5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{590B21B0-2AFA-4329-82AD-EF180C50EB5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{590B21B0-2AFA-4329-82AD-EF180C50EB5C}.Release|Any CPU.Build.0 = Release|Any CPU
{8C02EBBE-9EC8-4F47-9464-5A94BDE25A8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8C02EBBE-9EC8-4F47-9464-5A94BDE25A8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8C02EBBE-9EC8-4F47-9464-5A94BDE25A8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8C02EBBE-9EC8-4F47-9464-5A94BDE25A8F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -70,7 +76,8 @@ Global
{FD8BB8F9-9AF5-4C12-B962-9E08C30B01E2} = {520AB1D3-C501-40FD-ACEB-7CC0D1F00B90}
{4A12B042-76B3-471B-9235-F653E1ABE3C0} = {520AB1D3-C501-40FD-ACEB-7CC0D1F00B90}
{63416AEA-DA51-4D62-B566-DB7D9BC800DC} = {FBAC4C17-D755-49A9-959D-18FD6B95B543}
{590B21B0-2AFA-4329-82AD-EF180C50EB5C} = {2DAF5EF9-8F8E-4C51-BE2D-8D63CA143360}
{9D94CD6C-9451-449A-BED2-1C07D624A8E0} = {520AB1D3-C501-40FD-ACEB-7CC0D1F00B90}
{590B21B0-2AFA-4329-82AD-EF180C50EB5C} = {2DAF5EF9-8F8E-4C51-BE2D-8D63CA143360}
{8C02EBBE-9EC8-4F47-9464-5A94BDE25A8F} = {520AB1D3-C501-40FD-ACEB-7CC0D1F00B90}
EndGlobalSection
EndGlobal
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,26 @@
[![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/)
[![Build Status](https://geeklearning.visualstudio.com/_apis/public/build/definitions/f841b266-7595-4d01-9ee1-4864cf65aa73/27/badge)](#)

# gl-dotnet-storage
# Geek Learning Cloud Storage Abstraction

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

#Storage Abstraction
## Features

#FileSystem provider
* List files, with globbing support
* Read, Write, Delete files
* Public file url

#Azure blob provider
## Providers

The library currently supports:
* Azure Blob Storage
* File System Storage

We don't support for Amazon S3, but it is one of our high priority objective.

## Getting Started

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).
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"projects": [ "src", "tests", "samples" ],
"sdk": {
"version": "1.0.0-preview2-003133"
"version": "1.0.0-preview2-1-003177"
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using System.Text;

// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860

namespace GeekLearning.Storage.BasicSample.Controllers
namespace GeekLearning.Storage.BasicSample.Controllers
{
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

[Route("api/[controller]")]
public class SampleController : Controller
{
Expand All @@ -19,30 +16,26 @@ public SampleController(IStorageFactory storageFactory)
this.sharedAssets = storageFactory.GetStore("SharedAssets");
}

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

// GET api/values/5
[HttpGet]
public async Task<string> Get(string path)
{
var summary = await this.sharedAssets.GetAsync(path);
return await summary.ReadAllTextAsync();
}

// PUT api/values/5
[HttpPut()]
public async Task Put(string path, [FromBody]string value)
{
await sharedAssets.SaveAsync(Encoding.UTF8.GetBytes(value), path, "text/plain");
}

// DELETE api/values/5
[HttpDelete()]
public async Task Delete(string path)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,51 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace GeekLearning.Storage.BasicSample.Controllers
namespace GeekLearning.Storage.BasicSample.Controllers
{
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

[Route("api/[controller]")]
public class ValuesController : Controller
{
// GET api/values
private TemplatesStore templates;

public ValuesController(TemplatesStore templates)
{
this.templates = templates;
}

// GET: api/values
[HttpGet]
public async Task<IEnumerable<string>> Get()
{

return new string[] { await templates.Store.ReadAllTextAsync("json.json"), "value2" };
}

// GET api/values/5
[HttpGet("files")]
public async Task<IEnumerable<string>> Get(int id)
{
var files = await templates.Store.ListAsync("");
return files.Select(x => x.PublicUrl);
}

// POST api/values
[HttpPost]
public void Post([FromBody]string value)
{
}

// PUT api/values/5
[HttpPut("{id}")]
public void Put(int id, [FromBody]string value)
{
}

// DELETE api/values/5
[HttpDelete("{id}")]
public void Delete(int id)
{
Expand Down
14 changes: 5 additions & 9 deletions samples/GeekLearning.Storage.BasicSample/Program.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;

namespace GeekLearning.Storage.BasicSample
namespace GeekLearning.Storage.BasicSample
{
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using System.IO;

public class Program
{
public static void Main(string[] args)
Expand Down
25 changes: 10 additions & 15 deletions samples/GeekLearning.Storage.BasicSample/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System.Security.Cryptography;

namespace GeekLearning.Storage.BasicSample
namespace GeekLearning.Storage.BasicSample
{
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System;
using System.Security.Cryptography;

public class Startup
{
public Startup(IHostingEnvironment env)
Expand All @@ -25,12 +22,11 @@ public Startup(IHostingEnvironment env)
}

public IConfigurationRoot Configuration { get; }

public IHostingEnvironment HostingEnvironement { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();

var rng = RandomNumberGenerator.Create();
Expand All @@ -50,7 +46,6 @@ public void ConfigureServices(IServiceCollection services)
services.AddScoped<TemplatesStore>();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
Expand Down
7 changes: 1 addition & 6 deletions samples/GeekLearning.Storage.BasicSample/TemplatesStore.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace GeekLearning.Storage.BasicSample
namespace GeekLearning.Storage.BasicSample
{
public class TemplatesStore : StoreBase
{
Expand Down
28 changes: 14 additions & 14 deletions samples/GeekLearning.Storage.BasicSample/project.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
"version": "1.1.0",
"type": "platform"
},
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.Extensions.Options": "1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",

"GeekLearning.Storage": "*",
"GeekLearning.Storage.Azure": "*",
"GeekLearning.Storage.FileSystem": "*",
Expand All @@ -26,9 +27,8 @@
},

"frameworks": {
"netcoreapp1.0": {
"netcoreapp1.1": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
Expand Down
5 changes: 0 additions & 5 deletions samples/GeekLearning.Storage.BasicSample/web.config
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>

<!--
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
-->

<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
Expand Down
1 change: 0 additions & 1 deletion src/GeekLearning.Storage.Azure/AzureStorageExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

public static class AzureStorageExtensions
{

public static IServiceCollection AddAzureStorage(this IServiceCollection services)
{
services.TryAddEnumerable(ServiceDescriptor.Transient<IStorageProvider, AzureStorageProvider>());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

public class AzureStorageManagerOptions
{
public Dictionary<string,SubStore> SubStores { get; set; }
public Dictionary<string, SubStore> SubStores { get; set; }

public class SubStore
{
Expand Down
8 changes: 1 addition & 7 deletions src/GeekLearning.Storage.Azure/AzureStorageProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@

public class AzureStorageProvider : IStorageProvider
{
public string Name
{
get
{
return "Azure";
}
}
public string Name => "Azure";

public IStore BuildStore(string storeName, IStorageStoreOptions storeOptions)
{
Expand Down
Loading