Skip to content
/ fsdb Public

A Clojure library that provides a reasonably convenient readonly database on top of the file system.

License

Notifications You must be signed in to change notification settings

200ok-ch/fsdb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clojars Project

fsdb

A Clojure library that provides a reasonably convenient database on top of the file system.

Idea

The idea behind fsdb is simple. One or more files on a file system make up a database. The files can be of different formats and can be structured in a directory tree. The names of directories and files as well as the content of the files make up a database.

Here is an example:

% tree example
example
├── people.edn
├── technologies.edn
└── technologies
    └── clojure.yml

$ cat example/people.edn
{:rich {:name "Rich Hickey"}}

$ cat example/technologies.edn
{:clojure {:year "unknown"}}

$ cat example/technologies/clojure.yml
---
year: 2007

Reading this structure with fsdb/read-tree will result in the following data structure:

{:example
 {:people {:rich {:name "Rich Hickey"}}
  :technologies {:clojure {:year 2007}}}}

In this example you can observe multiple aspects of fsdb.

  • The db is spread of multiple files, these will be merged deeply.
  • The files can have different formats.
  • Names of directories & files make up the nesting of the resulting data structure.
  • Later (more specific entries) overwrite former.

Metadata

fsdb automatically contextualizes the data. Objects in the resulting data structure have :path as well as :key set in the metadata.

(-> data :example :people :rich meta :path) ;=> [:example :people :rich]
(-> data :example :people :rich meta :key) ;=> :rich

Usage

(ns your-ns
  (:require [fsdb]))

(clojure.pprint/pprint (fsdb/read-tree "example"))

License

Copyright © 2017-2021 200ok llc [email protected]

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

About

A Clojure library that provides a reasonably convenient readonly database on top of the file system.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published