Last active
August 29, 2015 14:27
-
-
Save ulikoehler/9006acbd142c24ad29e3 to your computer and use it in GitHub Desktop.
LevelDB FUSE filesystem (pre-alpha)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <fusekit/daemon.h> | |
#include <fusekit/default_directory.h> | |
#include <fusekit/stream_object_file.h> | |
/// example demonstrates how to create hierarchical structure | |
/// by creating directories and by by adding files to this | |
/// newly created directories. | |
/// | |
/// so directory struture should look like the following | |
/// (explore with ls and cd from shell) | |
/// mountpoint/s | |
/// mountpoint/a/s | |
/// mountpoint/b/s | |
/// when started with like | |
/// $folders mountpoint | |
int main( int argc, char* argv[] ){ | |
fusekit::daemon<>& daemon = fusekit::daemon<>::instance(); | |
std::string s1("i am a child of /"); | |
daemon.root().add_file("s", fusekit::make_iostream_object_file(s1)); | |
std::string s2("i am a child of /a"); | |
// you can hold references to directories (and files) you create | |
fusekit::default_directory<>::type& dir_a = daemon.root().add_directory( "a", fusekit::make_default_directory()); | |
dir_a.add_file("s", fusekit::make_iostream_object_file(s2)); | |
// or you can using chaining if you do not need the variable later on | |
std::string s3("i am a child of /b"); | |
daemon.root().add_directory( "b", fusekit::make_default_directory()). | |
add_file("s", fusekit::make_iostream_object_file(s3)); | |
return daemon.run(argc,argv); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: | |
gcc -Wall levelfs.cpp `pkg-config fuse --cflags --libs` -o levelfs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment