Coder Social home page Coder Social logo

mgree / ffs Goto Github PK

View Code? Open in Web Editor NEW
440.0 440.0 13.0 3.38 MB

the file filesystem: mount semi-structured data (like JSON) as a Unix filesystem

Home Page: https://mgree.github.io/ffs/

License: GNU General Public License v3.0

Rust 55.96% Shell 42.79% R 0.51% Makefile 0.03% Python 0.71%
bash console filesystem fish json shell toml yaml zsh

ffs's People

Contributors

larsch avatar mgree avatar nad2040 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ffs's Issues

Faster testing and benchmarking

We have a lot of sleep calls that could be faster.

Write a tool to detect when a mount is ready. (Current benchmarks do this by busy looping on umount.) Use its exit status to determine when it's okay to proceed on the mount and proceed checking that process has completed.

It'll also be useful to have a way to pad a few milliseconds on, i.e., unmount means the process may not be done yet. The current utils/timeout script is okay, but (a) it's noisy, and (b) it'd be nice to not fix it on ffs when we start. Maybe a waitfor command that takes a time limit before killing the process?

Revise mount CLI interface

Rather than taking a mountpoint as an argument, use an optional --mount flag.

If the input is over STDIN, you have to specify a --mount.

If the input is from a file foo.EXT, then try to make a directory foo. If that file already exists, give up and tell the user about --mount. If it doesn't, great: do that. When things unmount, double check the directory is empty and then remove it.

Need to revise all the tests, and then test a few configurations of this feature.

Auto-detect list directories

An idea from @angelhof: notice directories where every file has numerical name suffixes (e.g., role0, role1, or simpliciter 0, 1, 2, ...) and automatically treat them as lists.

The best way to do this is to use the auto type for directories, too, and new directories have that type assigned.

Website

Make a little doc/gh-pages directory. Include one of those cute screencast GIFs.

Sync/live flags

A --live flag to sync the JSON out on every write.

A --watch flag to notice updates to the JSON file and rebuild the FS.

With lazy/incremental, this would be complicated.

Invalid mount attempt leaves behind empty directory/member

Trying to mount a JSON file within the virtual filesystem fails (which is ok, I guess):

raphael@tukk ~/Downloads> ./ffs -i ffs1.json
raphael@tukk ~/Downloads> cat ffs1.json
{"option":"test"}
raphael@tukk ~/Downloads> cp ffs1.json ffs1/
raphael@tukk ~/Downloads> ls ffs1/
ffs1.json option
raphael@tukk ~/Downloads> ./ffs -i ffs1/ffs1.json
fusermount: bad mount point ffs1/ffs1: Permission denied
thread 'main' panicked at 'called Result::unwrap() on an Err
value: Os { code: 2, kind: NotFound, message: "No such file or
directory" }', src/main.rs:38:41
note: run with RUST_BACKTRACE=1 environment variable to display a
backtrace

This actually creates the subdirectory ffs1/ffs1 but does not mount anything there. Unmounting the filesystem results in an additional entry "ffs1: {}" in the json file. I'd suggest that a failed command should not leave behind any new files/members.

Empty file mounting fails

$> touch x.json
$> ffs x.son
thread 'main' panicked at 'JSON: Error("EOF while parsing a value", line: 1, column: 0)', src/format.rs:187:53
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

Invalid unmount on macOS

Investigate weird unmounts on macOS, producing:

WARN fuser::mnt::fuse2: umount failed with Os { code: 22, kind: InvalidInput, message: "Invalid argument" }

See actions log. Linux seems fine.

Formats

  • binary data via base64 2f483ea
  • TOML 688b78a
  • YAML 94917ed
  • XML moved to #15
  • Generic framework (detect/parse/unparse) c9198f9
  • choose output format independently of input format c9198f9
  • autodetection of formats
    • extension
    • speculation moved to #16
  • CLI options for specifying formats d441958

Metadata support

  • Options for naming of ListDirectory elements (prefix/suffix? format string?)
  • Metadata
    • extensions
    • dotfiles
    • xattrs in #30

Alternative models

Lazy loading (scan but don't parse into structures until demanded). #50

Ahead-of-time mappings (literally build/unbuild FS).

Use 9p, per Jay McCarthy. Or use the Bento FS thing?

Signal support

For example i3blocks supports multiple signals which you can trigger using pkill -SIGRTMIN+10 i3blocks, which then causes an action.

Could you add atleast two signals, one for re-reading INPUT file and another for writing OUTPUT file.
This would open ffs for uses in scripts and would allow updating INPUT and/or OUTPUT files without needing to restart ffs.

Name munging is never undone

The JSON object { ".": 5 } will create a file named dot holding the number 5... but it will dump back to JSON without restoring the name.

The best solution is probably to track an "unmunged" name, and files that don't undergo a rename call go back exactly how they were.

This unmunged name is metadata, so the appropriate mechanism for working with it is up in the air (see #2).

Option to pretty print output

Several format renderers can put the output in a nice, human-readable format. Why not treat yourself? We all deserve nice things.

Better error messages

On a malformed JSON file:

: mgree@rocinante:~/talks/20211025plos [master] ; ~/ffs/target/release/ffs -i demo.json 
thread 'main' panicked at 'JSON: Error("expected value", line: 7, column: 12)', src/format.rs:322:45
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.