Giter VIP home page Giter VIP logo

blobmetadb's Introduction

blobmetadb

An isometric metadata provider shim for Azure Blob Storage. Okay that's a shitty description. blobmetadb keeps track of your blobs and containers on the cloud and can provide info about it them using an offline database, like Redis.

Tasks like listing blobs, listing containers, checking if blob exists are lightning-fast compared to API requests to Azure Storage Service.

It plugs in very easily, with a little code change and a NuGet package to install and you're done.

Example List Blobs: Azure

In a container that has 20,000 blobs:

var account = new CloudStorageAccount (StorageCredentials ("ACCOUNT", "KEY"), true);
var blobs = client.GetContainerReference ("containerName").ListBlobs();
>>> Took 15.701 seconds.
Example List Blobs: BlobMetaDb
var blobTracker = new BlobMetaTracker (DiscoveryMode.AllRequests, new RedisBlobMetadataStore (), account);
var blobs = blobTracker.ListBlobsAsync("containerName").Result;
>>> Took 0.0491 seconds.

That's 300x faster and free (you don't make calls to Storage API).

Works with any key-value store

blobmetadb smartly works by listening Storage Service traffic of your application and understands what you store on the cloud and tell you information about blobs and containers you have, sizes of them very quickly.

We provide Redis support out of the box ('cause it's really cool.) Heck, you can even purchase a Redis instace from AWS Elasticache (or host it yourself). You can even use SQLite, SQL Server, MySQL or whatever as long as you write implementation of IBlobStorageMetadataStore interface.

Easy to plug in

You just make use of an optional operationContext parameter that exists on all official Azure Storage Client operations. You just add the following to your code:

OperationContext context = new OperationContext();
context.ResponseReceived += blobTracker.UseReceivedResponseAsync;

and from then on

Replace …To:
`client.CreateContainer(name)` `client.CreateContainer(name, operationContext: ctx)`
`blob.UploadFromFile(path)` `blob.UploadFromFile(path, operationContext: ctx)`
`blob.Delete()` `blob.Delete(operationContext: ctx)`
`container.DeleteIfExists()` `container.DeleteIfExists(operationContext: ctx)`

and so on… I bet you got the idea.

YMMV: Your blobs will be tracked only if all your blob requests are using operationContext. Previously created blobs and containers can be imported. Read on.

It's smart

It uses various hints from HTTP responses sent from Azure Storage Service to interpret blobs & containers are created or deleted, and even sizes of blobs. Just plug in, like shown just above.

Force synchronization & initial import

If you're already using Azure Storage Service for a while, when you initialize BlobMetaTracker instance just call blobTracker.ImportAllContainersAsync() once and it will import metadata (existance, size etc.) of blobs and containers to your local database.

It does not intercept calls you explicitly make to blob storage service (e.g. container.ListBlobs() or blob.Exists()). You need to make calls to BlobMetaTracker class directly (e.g. blobTracker.ListBlobs(container) or blobTracker.BlobExists(container, blob)).

Wiki

More info on wiki:

Few cool facts

  • It is a fully asynchronous library.
  • It's distributed on NuGet.
  • It will not keep in sync with your storage account by itself, you need to use this everywhere in your code to keep local database up to date.
  • It is inspired by Nathan Cahill's mimicdb.
  • It is developed in Seattle, on a MacBook using Mono.

FAQ

Q: Is it a cache for blobs?
A: No, it is not. It can just tell you if blob or container exists and can list you the containers in your account and blobs in a container.

Q: Is it supported or developed by Microsoft?
A: No, it is not. This is merely a side project and has nothing to do with Microsoft Corporation. It is not anything official. See license.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.