Giter Site home page Giter Site logo

blocks-monger's Introduction

blocks-monger

This library provides a content-addressable block store.

Installation

The library can be installed from Clojars using Leiningen:

Clojars Project

Usage

The blocks.store.monger namespace provides the monger-block-store constructor. Specify at least the host and db-name option to connect to your MongoDB server.

Blocks are stored in a collection named blocks. Each document contains the hex-encoded id of the stored block, meta data, algorithm and data (base64 encoded).

=> (require '[blocks.core :as blocks]
            '[blocks.store.monger])

; create a new block store:
=> (def store (blocks/->store "monger://localhost/my-storage"))

; insert block:
=> @(blocks/put! store (blocks/read! "hello world"))
Block[hash:sha2-256:b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9 11 *]

; listing blocks - data is filtered on server-side:
=> (blocks/list-seq store :limit 1 :algorithm :sha2-256 :after "122")
(Block[hash:sha2-256:b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9 11 *])

; deleting all documents:
(blocks/erase! store)

blocks-monger's People

Contributors

20centaurifux avatar

Watchers

 avatar  avatar  avatar

blocks-monger's Issues

Upgrade to blocks 2.x

Version 2.0.0 of blocks has many changes to the storage interface. This primarily involves making the store methods asynchronous to support higher-performance and concurrent usage of the store. In addition, there have been several simplifications to the codebase.

This implementation needs to be upgraded to support the new interfaces; a simple version of this would involve wrapping futures around each of the existing methods. Listing as a stream is a bit more complex though - for pointers, see the s3 implementation.

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.