Skip to content

MongoDB storage backend for blocks (content-addressable data storage).

License

Notifications You must be signed in to change notification settings

20centaurifux/blocks-monger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

MongoDB storage backend for blocks (content-addressable data storage).

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published