Git Product home page Git Product logo

meta-blob-store's Introduction

meta-blob-store

Build Status

blob-store-compatible

This is a way of tying together several different blob-stores to operate as one.

The module exports a single function taking in a config object, and returns a blob-store. The properties of the config object correspond to the methods available on blob-stores (i.e. createReadStream, createWriteStream, exists, remove). If exists is omitted, the blob-store for createReadStream is used instead for those calls. remove also defers to createWriteStream in the same way. Each of these can either be a blob store to forward the calls for that method to, or an array of arrays that's used to match keys to blob-stores based on regular expressions. For example:

var metaStore = MetaBlobStore({
    createReadStream: [
        [/^foo/, blobStore1],
        [/.*/, blobStore2]
    ],
    createWriteStream: blobStore3
});

In this example, for createReadStream and exists calls, the call will be sent to blobStore2 except when the key in the arguments starts with foo, in which case the call will be sent to blobStore1. All calls to createWriteStream and remove are sent to blobStore3.

One thing this doesn't cover is cases where you want to send the calls to more than one blob store. This is farily complex since there are many cases. Do you want to write to both all the time or alternate? Do you want to read from both and append one to the other? Or some other stream multiplexing? Different use cases call for different solutions here, so this is left as an exercise.

This all allows for some pretty complicated routing of your blobs, so be careful!

License

MIT. See LICENSE.txt

meta-blob-store's People

Contributors

bengl avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

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.