Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a storage library that abstracts away Azure, S3 and others?

I am developing an application that supports running in the cloud, either Amazon or Azure. Once of the components I need is an abstraction around the storage APIs (Blobs and Queues). I can write an abstraction layer, but I still end up with a huge set of dependencies (all the Azure and Amazon libraries). What I want is a component that provides pure HTTP access, so I don't need to take any external dependencies. Does such a beast exist?

Edit

What I have done so far is to build an interface that abstracts away the basic operation on blobs. What I've ended up with is similar to the following:

public interface IBlobService {
  Task<Stream> DownloadBlob(string container, string blob);
  IEnumerable<string> ListBlobs(string container);
  void PutBlob(string container, string blob, Stream data);
}

I understand that the different services have different behaviors, but both support a basic set of CRUD operations. What I'm finding is that I keep adding additional methods that change the calling behavior. For example, addition to

void PutBlob(string container, string blob, Stream data);

I end up also needing

void PutBlob(string container, string blob, byte[] data);

After building the nth method in both services, I realized that someone must have done this already. Given that both are simply wrappers around the respective HTTP interfaces, what I am looking for is a library that provides an abstraction around these operations. The difference between sending a byte array and a stream is zero as far as the HTTP is concerned, but each service requires it's own flavor (headers, encoding, HMAC, etc).

What I want is similar to what ODBC provides for databases - an API that provides a common set of functionality, while acknowledging that there are differences in the backing platform. I hope this narrows the request down enough.

Thanks, Erick

like image 305
Erick T Avatar asked Apr 22 '15 17:04

Erick T


1 Answers

The library TwentyTwenty.Storage is a abstraction for the storage of blobs. It defines interfaces and some implemntations exist for Azure, Amazon S3, Google Cloud storage, and the local file system. More information on the github of project : TwentyTwenty.Storage

It is available for .net 4.5 and .net core (netstandard 1.3), and can be installed via nuget.

like image 192
gentiane Avatar answered Nov 06 '22 04:11

gentiane