• This repository has been archived on 02/Nov/2020
  • Stars
    star
    198
  • Rank 196,898 (Top 4 %)
  • Language
    C
  • License
    MIT License
  • Created over 13 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ”ฅ a versioning filesystem inspired by git

phoenixfs

A filesystem implemented in userspace (using FUSE), inspired by the way Git is designed. Only works on Linux, since macOS implements userspace filesystems differently. Seamlessly versions files on save, without any additional machinery: traps save events in the editor, and writes out to a mount point, in the form of loose objects.

Dependencies

  1. Zlib (>= 1.2)
  2. FUSE (>= 2.6)
  3. pkg-config (>= 0.25)
  4. Linux kernel (>= 2.6.15)

Usage

For the first run, you need two directories:

  1. A git directory where the data will be stored.
  2. An empty directory to use as the mountpoint.
 $ cd /tmp
 $ mkdir gitdir mountp
 $ phoneixfs mount gitdir mountp

Use the mountpoint as you see fit. Data will be written to the gitdir on umount: you can use it for subsequent mounts.

Now, everything in mountpoint is versioned. To access older revisions of FILE, use FILE@REV syntax, where REV is the number of revisions in the past you want to access. For example:

 $ echo "hello" >file1
 $ echo "goodbye" >file1
 $ echo "another hello" >file1
 $ cat file1
 another hello
 $ cat file1@1
 goodbye
 $ cat file1@2
 hello

Finally, to umount:

 $ fusermount -u mountp

Technical documentation

Uses a B+ tree to keep track of the filesystem tree, and a modified version of packfile v3/ packfile index v2 for storing revision information.

  • gitdir/.git/loose/ contains zlib-deflated versions of content blobs, named by the SHA-1 digest of the content.

  • gitdir/fstree is a raw dump of the B+ tree in a custom format.

  • gitdir/master.pack and gitdir/master.idx are the packfile and packfile index respectively. During an unmount, the files in gitdir/.git/loose/ are packed up, and an index is generated.

  • /tmp/phoenixfs.log is the debug log

master.idx, master.pack, and fstree are enough to recreate the entire versioned filesystem. The files in gitdir/ and gitdir/.git/loose/ can be removed after unmount.

Notes on the filesystem tree:

(dr: directory record | fr: file record | vfr: versioned file record)

  • dr just contains a name and node pointer referencing vfrs. drs are inserted directly into the root node.

  • vfr contains the path of the file, a list of frs representing the various versions of the file (fixed at REV_TRUNCATE), and a HEAD pointer to keep track of the latest version of the file.

  • The B+ tree is keyed by the CRC32 hash of the path of the vfr/ dr, a design decision inspired by Btrfs.

  • An fr, vfr, and dr (corresponding to its path) are created when a new file is created on the filesystem. Empty directories are not tracked: no dr is created for empty directories.

Limitations

The following invocations don't work:

 $ cp file1@1 file1 # FILE@REV can't be treated like a file

Contributing

Simply fork the project on GitHub and send pull requests.

More Repositories

1

rhine-ml

๐Ÿž an OCaml compiler for an untyped lisp
OCaml
630
star
2

clayoven

๐Ÿ’Ž beautiful website generator aimed at math-heavy sites
Ruby
332
star
3

rhine

๐Ÿ”ฌ a C++ compiler middle-end, using an LLVM backend
C++
161
star
4

bonak

๐ŸงŠ An indexed construction of semi-simplicial and semi-cubical types
TeX
25
star
5

ibex

๐Ÿ imap client written in go and js
Go
21
star
6

ublog.el

๐Ÿ—ฟ elisp artifact โ€“ worked as a twitter client briefly
Emacs Lisp
18
star
7

vsfstar

๐Ÿฆ… VSCode extension for F* with IDE features
TypeScript
15
star
8

dotfiles

๐Ÿ“‚ gitconfig, ruby, perl, nvim
Python
10
star
9

atomic-rtags

๐Ÿ”– rtags for Atom
CoffeeScript
9
star
10

boot-wrapper-aarch64

๐Ÿฅพ boot wrapper for AArch64 linux
Assembly
7
star
11

artagnon.com

โˆž my online presence โ€” generated by clayoven
HTML
6
star
12

vsclay

๐Ÿฏ vscode extension for syntax-highlighting claytext, with IntelliSense for MathJaX
TypeScript
5
star
13

rejourn

โ™จ๏ธ static html generator โ€” abandoned in favor of clayoven
Python
5
star
14

FreelyCommute

๐Ÿ–‹ reMarkable v5 parser
C++
3
star
15

proofsauce

๐Ÿณ Experiments in Coq
Coq
1
star
16

vstwig

๐Ÿˆธ vscode extension for PHP Twig
TypeScript
1
star
17

tree-sitter-mlir

MLIR grammar for tree-sitter
JavaScript
1
star
18

sauerkraut

โฒ a mishmash of matrix multiplication algorithms
C++
1
star
19

megafinder

๐Ÿ”ญ Atom plugin for running find and fuzzy-filtering
JavaScript
1
star
20

sandbox

โ›ฑ project euler in haskell, programming puzzles, toys
C++
1
star