Code Monkey home page Code Monkey logo

bolt-mount's Introduction

Mount a Bolt database as a FUSE filesystem

Bolt is a key-value store that also supports nested buckets. This makes it look a little bit like a file system tree.

bolt-mount exposes a Bolt database as a FUSE file system.

$ go get bazil.org/bolt-mount
# assuming $GOPATH/bin is in $PATH
$ mkdir mnt
$ bolt-mount mydatabase.bolt mnt &
$ cd mnt
$ mkdir bucket
$ mkdir bucket/sub
$ echo Hello, world >bucket/sub/greeting
$ ls -l bucket
total 0
drwxr-xr-x 1 root root 0 Apr 25 18:00 sub/
$ ls -l bucket/sub
total 0
-rw-r--r-- 1 root root 0 Apr 25 18:00 greeting
$ cat bucket/sub/greeting
Hello, world
$ cd ..
# for Linux
$ fusermount -u mnt
# for OS X
$ umount mnt
[1]+  Done                    bolt-mount mydatabase.bolt mnt

Encoding keys to file names

As Bolt keys can contain arbitrary bytes, but file names cannot, the keys are encoded.

First, we define safe as:

  • ASCII letters and numbers
  • the characters ".", "," "-", "_" (period/dot, comma, dash, underscore)

A name consisting completely of safe characters, and not starting with a dot, is unaltered. Everything else is hex-encoded. Hex encoding looks like @xx[xx..] where xx are lower case hex digits.

Additionally, any safe prefixes (not starting with a dot) and suffixes longer than than a noise threshold remain unaltered. They are separated from the hex encoded middle part by a semicolon, as in [PREFIX:]MIDDLE[:SUFFIX].

For example:

A Bolt key packing two little-endian uint16 values 42 and 10000 and the string "test" is encoded as filename @002a2710:test.

bolt-mount's People

Contributors

tv42 avatar

Watchers

 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.